Assert to compare two lists of objects C#

前端 未结 3 810
梦谈多话
梦谈多话 2021-01-14 17:13

I am currently trying to learn how to use unit testing, and I have created the actual list of 3 animal objects and the expected list of 3 animal objects. The question is how

3条回答
  •  长发绾君心
    2021-01-14 17:40

    That is correct, as the lists are 2 different objects containing the similar data.

    In order to get compare lists you should use the CollectionAssert

    CollectionAssert.AreEqual(expected ,actual);
    

    That should do the trick.

提交回复
热议问题