diff --git a/docs/_pages/collections.md b/docs/_pages/collections.md index bd4905ca10..ed0df7a81a 100644 --- a/docs/_pages/collections.md +++ b/docs/_pages/collections.md @@ -80,6 +80,10 @@ IEnumerable otherCollection = new[] { 1, 2, 5, 8, 1 }; IEnumerable anotherCollection = new[] { 10, 20, 50, 80, 10 }; collection.Should().IntersectWith(otherCollection); collection.Should().NotIntersectWith(anotherCollection); + +var singleEquivalent = new[] { new { Size = 42 } }; +singleEquivalent.Should().ContainSingle() + .Which.Should().BeEquivalentTo(new { Size = 42 }); ``` Asserting that a collection contains items in a certain order is as easy as using one of the several overloads of `BeInAscendingOrder` or `BeInDescendingOrder`. The default overload will use the default `Comparer` for the specified type, but overloads also exist that take an `IComparer`, a property expression to sort by an object's property, or a lambda expression to avoid the need for `IComparer` implementations.