Alex Rivera | Logout

What's the difference between Assert.AreNotEqual and Assert.AreNotSame?

Asked 2009-02-12T21:07:54.330
65

In C#, what's the difference between

Assert.AreNotEqual

and

Assert.AreNotSame
Edit
Report

1 Answer

3

Isn't it so that AreNotEqual checks for the case where two objects are not equal in terms of Equals() method, whereas AreNotSame checks for the case where the two object references are not the same. So if x and y are two objects which are equal in terms of Equals() but have been separately allocated, AreNotEqual() would trigger failing assertion but the other not.

answered 2009-02-12T21:13:06.220

Your Answer