Example #1
0
        public void EqualsWithOneTransientObjectReturnsFalse()
        {
            var obj1 = new TestEntity() {
                Name = "Vasya",
            };
            var obj2 = new TestEntity() {
                Name = "Vasya",
            };

            obj1.Save();

            var equality = Equals(obj1, obj2);

            Assert.AreEqual(false, equality);
        }
Example #2
0
        public void EqualsWithDifferentIdsReturnsFalse()
        {
            var obj1 = new TestEntity() {
                Name = "Vasya",
            };
            var obj2 = new TestEntity() {
                Name = "Vasya",
            };

            obj1.Save();
            obj2.Save();

            var equality = Equals(obj1, obj2);

            Assert.AreEqual(false, equality);
        }
Example #3
0
        public void EqualsWithSameIdsInDisparateClassesReturnsFalse()
        {
            var obj1 = new TestEntity() {
                ID = 1,
                Name = "Vasya",
            };
            var obj2 = new OtherTestEntity() {
                ID = 1,
                Name = "Vasya",
            };

            obj1.Save();
            obj2.Save();

            var equality = Equals(obj1, obj2);

            Assert.AreEqual(false, equality);
        }
Example #4
0
        public void EqualsWithSameIdsReturnsTrue()
        {
            var obj1 = new TestEntity() {
                Name = "Vasya",
            };

            obj1.Save();
            var obj2 = TestEntity.DataSource.First();

            foreach (TestEntity.Fields en in Enum.GetValues(typeof(TestEntity.Fields))) {
                Assert.AreEqual(obj1[en], obj2[en]);
            }
        }