var expectedPerson = new Person() { FirstName = "John", LastName = "Doe", Age = 30 }; var actualPerson = new Person() { FirstName = "John", LastName = "Doe", Age = 30 }; actualPerson.ShouldBeEquivalentTo(expectedPerson);
var expectedListOfStrings = new ListThis example compares two lists of strings. The `WithStrictOrdering` option ensures that the order of the items in the lists is also checked. The System ShouldBeEquivalentTo method is part of the FluentAssertions package library, which is commonly used for testing in C#. This package can be installed via NuGet.() { "apple", "banana", "orange" }; var actualListOfStrings = new List () { "apple", "banana", "cherry" }; actualListOfStrings.ShouldBeEquivalentTo(expectedListOfStrings, options => options.WithStrictOrdering());