I want to assert that at least one item of a collection matches a given predicate with NUnit. I already asserted that the number of items is greater than 0, so it suffices to mimic the behavior of LINQ's
Assert.That(resultEnumerable, Is.Any.Matching(x => x.Property == "x"));
Assert.That(resultEnumerable.Select(x => x.Property), Is.Any.EqualTo("x"));
Assert.That(resultEnumerable.Any(x => x.Property == "x"), Is.True);
How about one of these?
Assert.That (resultEnumerable, Has.Some.Property ("Property").EqualTo ("x")); Assert.That (resultEnumerable, Has.Some.Matches<X> (x => x.Property == "x"));