如何断言嵌套列表,而不“取消”它?
expected.Add(new Customer{
Edition = "Cust",
Rarity = "R",
ID = 1001,
Name = "John Doe",
Types = new List<Type_>{
new Type_{
ID = 1,
Name = "abc"
}
},
这里断言:
CollectionAssert.AreEqual(expected, actual);
这肯定会排除嵌套列表。
答案 0 :(得分:2)
对我有用的东西:
编辑,这是传统方法的一个例子:
var expected = new List<Type_>{
new Type_{
ID = 1,
Name = "abc"
};
CollectionAssert.AreEqual(expected, actual.Types);