Say I want to test a method returning a bunch of items of the following type using fluent-assertions to ensure that all items have their IsActive
-flag set to true
:
public class Item
{
public bool IsActive { get; set; }
}
To achieve that I could simply iterate over the collection and assert every item separately in a foreach-loop:
var items = CreateABunchOfActiveItems();
foreach (var item in items)
{
item.IsActive.Should().BeTrue("because I said so!");
}
But is there a more fluent way to assert every item in the whole collection at once?