Legacy Documentation. View NUnit 3 Documentation

Identity Asserts

Assert.AreSame and Assert.AreNotSame test whether the same objects are referenced by the two arguments.

Assert.AreSame( object expected, object actual );
Assert.AreSame( object expected, object actual, string message );
Assert.AreSame( object expected, object actual, string message,
                params object[] parms );

Assert.AreNotSame( object expected, object actual );
Assert.AreNotSame( object expected, object actual, string message );
Assert.AreNotSame( object expected, object actual, string message,
                params object[] parms );

Assert.Contains is used to test whether an object is contained in an array or list.

Assert.Contains( object anObject, IList collection );
Assert.Contains( object anObject, IList collection,
                string message );
Assert.Contains( object anObject, IList collection,
                string message, params object[] parms );