Unit Test Assert.AreEqual failed

后端 未结 6 1405
别那么骄傲
别那么骄傲 2021-01-17 16:12

I have a unit test for a method which gets an object from a collection. This keeps failing and I cannot see why, so I have created a very simple test below to create 2 suppl

6条回答
  •  Happy的楠姐
    2021-01-17 16:36

    When testing the individual properties, you compare the string/integer values. They are equal, and so the tests pass.

    When testing the parent objects, you compare only the two container structures of type Supplier - and even though those may hold equal property values, they are not equal: Since you are instantiating two separate objects, they do not reside at the same address in memory.

提交回复
热议问题