示例#1
0
        public void ComparerReturnsTrueIfOjectsAreSameInstance()
        {
            var comparer = new ObjectReferenceComparer <ObjRefComparerTestStub>();

            var x = new ObjRefComparerTestStub(1);
            var y = x;

            bool result = comparer.Equals(x, y);

            Assert.IsTrue(result);
        }
示例#2
0
        public void ComparerReturnsFalseIfObjectsAreNotSame()
        {
            var comparer = new ObjectReferenceComparer <ObjRefComparerTestStub>();

            var x = new ObjRefComparerTestStub(1);
            var y = new ObjRefComparerTestStub(2);

            bool result = comparer.Equals(x, y);

            Assert.IsFalse(result);
        }
示例#3
0
        public void ComparerReturnsFalseIfObjectsAreNotSameInstanceIgnoringEquatableImplementation()
        {
            var comparer = new ObjectReferenceComparer <ObjRefComparerTestStub>();

            var x = new ObjRefComparerTestStub(1);
            var y = new ObjRefComparerTestStub(1);

            bool comparerResult = comparer.Equals(x, y);
            bool equalsResult   = x.Equals(y);

            Assert.IsFalse(comparerResult);
            Assert.IsTrue(equalsResult);
        }
示例#4
0
        public void ComparerInitialises()
        {
            var comparer = new ObjectReferenceComparer <ObjRefComparerTestStub>();

            Assert.IsNotNull(comparer);
        }