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

New Post: Confusion with OnlyContain usage

$
0
0
Here's a work-around for anyone who wants the old behaviour:
public static AndConstraint<GenericCollectionAssertions<T>> ReallyOnlyContain<T>(this GenericCollectionAssertions<T> itemsAssertion, Expression<Func<T, bool>> expectedItem)
{
    var notExpectedItem = Expression.Lambda<Func<T, bool>>(Expression.Not(expectedItem.Body), expectedItem.Parameters);
    return itemsAssertion.NotContain(notExpectedItem);
}

Viewing all articles
Browse latest Browse all 1402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>