Have

ShouldHaveSingleItem

var maggie = new Person { Name = "Maggie" };
var homer = new Person { Name = "Homer" };
var simpsonsBabies = new List<Person> { homer, maggie };
simpsonsBabies.ShouldHaveSingleItem();

snippet source | anchor

Exception

simpsonsBabies
    should have single item but had
2
    items and was
[Homer, Maggie]

Last updated