c# - FluentAssertions, making sure IEnumerable contains only single element -


i writing unit tests , have looks this:

[fact] public void getfoos_only_gets_foo1() {     _foo1.included = true; //foo object     _foo2.included = false; //foo object     _sut.getfoos().should().onlycontain(_foo1); // doesn't work, there specific syntax use? } 

and getfoos() returns , ienumberable<foo>

onlycontain expects predicate -

 getfoos().should().onlycontain(x => _foo1.equals(x)); 

Comments