Reputation: 299
How to assert a nested list too, without 'unnesting' it?
expected.Add(new Customer{
Edition = "Cust",
Rarity = "R",
ID = 1001,
Name = "John Doe",
Types = new List<Type_>{
new Type_{
ID = 1,
Name = "abc"
}
},
Here the assert:
CollectionAssert.AreEqual(expected, actual);
That certainly exclude the nested list.
Upvotes: 0
Views: 1127
Reputation: 35895
Something that worked for me:
Edit, here is an example of conventional approach:
var expected = new List<Type_>{
new Type_{
ID = 1,
Name = "abc"
};
CollectionAssert.AreEqual(expected, actual.Types);
Upvotes: 2