I am writing unit tests and I have something that looks like this:
[Fact]
public void GetFoos_only_gets_foo1()
{
_foo1.included = true; //Foo object
_foo2.included = false; //Foo object
_sut.GetFoos().Should().OnlyContain(_foo1); // this doesn't work, is there a specific syntax to use?
}
And GetFoos()
returns and IEnumberable<Foo>
Try this page as see if it helps. https://github.com/dennisdoomen/fluentassertions/wiki
OnlyContain expects a predicate -