MSTest: CollectionAssert.AreEquivalent failed. The expected collection contains 1 occurrence(s) of

前端 未结 5 604
生来不讨喜
生来不讨喜 2020-12-08 20:23

Question:

Can anyone tell me why my unit test is failing with this error message?

CollectionAssert.AreEquivalent failed. The

5条回答
  •  孤城傲影
    2020-12-08 20:59

    You are absolutely right. Unless you provide something like an IEqualityComparer or implement MyPerson.Equals(), the two MyPerson objects will be compared with object.Equals, just like any other object. Since the objects are different, the Assert will fail.

提交回复
热议问题