I want to assert that a collection of simple objects includes a smaller collection of the same object type. For some reason actualCollection.Should().Contain(expectedCollection) is failing with a message that shows all of the expected objects are in the actual collection but it's claiming that they aren't.
Here's the assertion failure output I'm getting:
```
Expected collection {
ActivityServiceTest.DataTypes.SocialItemSummary
{
category = "custom"
percentage = 0.333333333333333
},
ActivityServiceTest.DataTypes.SocialItemSummary
{
category = "friends"
percentage = 0
},
ActivityServiceTest.DataTypes.SocialItemSummary
{
category = "friends of friends"
percentage = 0.333333333333333
},
ActivityServiceTest.DataTypes.SocialItemSummary
{
category = "only me"
percentage = 0
},
ActivityServiceTest.DataTypes.SocialItemSummary
{
category = "public"
percentage = 0.333333333333333
}} to contain {
ActivityServiceTest.DataTypes.SocialItemSummary
{
category = "custom"
percentage = 0.333333333333333
},
ActivityServiceTest.DataTypes.SocialItemSummary
{
category = "friends of friends"
percentage = 0.333333333333333
},
ActivityServiceTest.DataTypes.SocialItemSummary
{
category = "public"
percentage = 0.333333333333333
}}, but could not find {
ActivityServiceTest.DataTypes.SocialItemSummary
{
category = "custom"
percentage = 0.333333333333333
},
ActivityServiceTest.DataTypes.SocialItemSummary
{
category = "friends of friends"
percentage = 0.333333333333333
},
ActivityServiceTest.DataTypes.SocialItemSummary
{
category = "public"
percentage = 0.333333333333333
}}
```
Comments: I do understand why you need structural equality in this particular case, but I'm in no way saying your should implement Equals() all over your code base. Only types that have value semantics need that. For instance, in Domain Driven Design, an object like you showed in your example would probably be a Value Object and immutable. In that case, it's quite natural to implement Equals(). Regardless, I'll consider your proposal. I just need to think of a good API.
Here's the assertion failure output I'm getting:
```
Expected collection {
ActivityServiceTest.DataTypes.SocialItemSummary
{
category = "custom"
percentage = 0.333333333333333
},
ActivityServiceTest.DataTypes.SocialItemSummary
{
category = "friends"
percentage = 0
},
ActivityServiceTest.DataTypes.SocialItemSummary
{
category = "friends of friends"
percentage = 0.333333333333333
},
ActivityServiceTest.DataTypes.SocialItemSummary
{
category = "only me"
percentage = 0
},
ActivityServiceTest.DataTypes.SocialItemSummary
{
category = "public"
percentage = 0.333333333333333
}} to contain {
ActivityServiceTest.DataTypes.SocialItemSummary
{
category = "custom"
percentage = 0.333333333333333
},
ActivityServiceTest.DataTypes.SocialItemSummary
{
category = "friends of friends"
percentage = 0.333333333333333
},
ActivityServiceTest.DataTypes.SocialItemSummary
{
category = "public"
percentage = 0.333333333333333
}}, but could not find {
ActivityServiceTest.DataTypes.SocialItemSummary
{
category = "custom"
percentage = 0.333333333333333
},
ActivityServiceTest.DataTypes.SocialItemSummary
{
category = "friends of friends"
percentage = 0.333333333333333
},
ActivityServiceTest.DataTypes.SocialItemSummary
{
category = "public"
percentage = 0.333333333333333
}}
```
Comments: I do understand why you need structural equality in this particular case, but I'm in no way saying your should implement Equals() all over your code base. Only types that have value semantics need that. For instance, in Domain Driven Design, an object like you showed in your example would probably be a Value Object and immutable. In that case, it's quite natural to implement Equals(). Regardless, I'll consider your proposal. I just need to think of a good API.