NUnit doesn't work well with Assert.AreEqual

前端 未结 4 1612
面向向阳花
面向向阳花 2021-01-17 13:29

I\'m new to unit testing and NUit in particular. I\'m just typing some examples from the book which refers to Java and JUnit. But I\'m using C# instead.

The problem

4条回答
  •  心在旅途
    2021-01-17 14:28

    I suspect your problem is that you haven't overridden overload the equality == operator. Under the hood the Assert.AreEqual is probably using ==.

    See Operator Overloading Tutorial.

    Update: I ran the NUnit test through the debugger and it does indeed use the Equals method and not the == operator.

提交回复
热议问题