AreNotSame() public method

Verifies that two specified object variables refer to different objects. The assertion fails if they refer to the same object.
public AreNotSame ( object expected, object actual, string message = null ) : void
expected object The expected reference.
actual object The actual reference.
message string An optional message to display if the assertion fails.
return void
Example #1
0
        public void AreNotSameShouldFailWithSameReferences()
        {
            var assert = new AssertClass();
            var obj1 = new object();
            var obj2 = obj1;
            assert.AreNotSame(obj1, obj2);

            Assert.AreEqual(TestOutcome.Failed, _args.Result.Outcome);
        }
Example #2
0
        public void AreNotSameShouldSuccedWithOneNullReference()
        {
            var assert = new AssertClass();
            assert.AreNotSame(new object(), null);

            Assert.AreEqual(TestOutcome.Succeeded, _args.Result.Outcome);
        }
Example #3
0
        public void AreNotSameShouldFailWithBothNullReferences()
        {
            var assert = new AssertClass();
            assert.AreNotSame(null, null);

            Assert.AreEqual(TestOutcome.Failed, _args.Result.Outcome);
        }
Example #4
0
        public void AreNotSameShouldSucceedWithDifferentReferences()
        {
            var assert = new AssertClass();
            var obj1 = new object();
            var obj2 = new object();
            assert.AreNotSame(obj1, obj2);

            Assert.AreEqual(TestOutcome.Succeeded, _args.Result.Outcome);
        }