Diff between Assert.AreEqual and Assert.AreSame?

Pramuka picture Pramuka · Jun 11, 2014 · Viewed 20.8k times · Source

What is the difference between Assert.AreEqual and Assert.AreSame?

Answer

magos picture magos · Jun 11, 2014

It means that AreSame() checks that they are the exact same object - if reference indicate the same object in memory.

AreEqual() checks that objects has equal type and value. Equal objects can exist in two different places in memory.