Ejemplo n.º 1
0
        public void TwoEntityObjectsWithSameIdAndVersionButDifferentTypesAreDifferent()
        {
            MyEntityObject o1 = new MyEntityObject(1, 1, "Mikkel");
            MyOtherEntityObject o2 = new MyOtherEntityObject(1, 1);
            MyExtendedEntityObject o3 = new MyExtendedEntityObject(1, 1, "Mikkel", 36);

            Assert.AreNotSame(o1, o2);
            Assert.AreNotSame(o1, o3);
            Assert.AreEqual(o1, o1);
            Assert.AreNotEqual(o1, o2);
            Assert.AreNotEqual(o2, o1);
            Assert.AreNotEqual(o1, o3);
            Assert.AreNotEqual(o3, o1);
            Assert.AreNotEqual(o1.GetHashCode(), o2.GetHashCode());
            Assert.AreNotEqual(o2.GetHashCode(), o1.GetHashCode());
            Assert.AreNotEqual(o1.GetHashCode(), o3.GetHashCode());
            Assert.AreNotEqual(o3.GetHashCode(), o1.GetHashCode());
        }