Quantcast
Channel: Fluent Assertions
Viewing all articles
Browse latest Browse all 1402

New Post: Confusion with OnlyContain usage

$
0
0
I don't agree with this. It's still true that an empty collection only contains elements matching a given criterion.

An example:
I wrote a test to verify that a method that transformed a collection of elements did not add any elements. The assertion was along the lines of "result.Should().OnlyContain(item => originalItems.Contains(item))".

If you won't change the behaviour, I think you should at least reflect the behaviour in the method's documentation:
Asserts that the collection is not empty and only contains items that match a predicate.

Viewing all articles
Browse latest Browse all 1402

Trending Articles