I have two objects (instances of the same class) with a bunch of properties, some of them lists of other objects.
class A {
public int a { get; set; }
public string b { get; set; }
public IList<C> cs { get; set; }
}
I want to compare these using the FluentAssertions library, and make sure they have the same properties, so I add
first.ShouldHave().AllProperties().EqualTo(second);
but then I get an error that
Expected property cs to have value <C, C, C> but found <C, C, C>
In other words, when comparing properties that are lists, it does a reference-equals, which obviously fails in this case.
How do I tell FluentAssertions to assert that the properties of the elements in the lists are equal, rather than the lists themselves?