Ejemplo n.º 1
0
        public void CanCompareInheritedDomainObjects()
        {
            var obj1 = new InheritedObjectWithExtraDomainSignatureProperty();
            var obj2 = new InheritedObjectWithExtraDomainSignatureProperty();

            obj1.Equals(obj2).Should().BeTrue();

            obj1.Age      = 13;
            obj1.IsLiving = true;
            obj2.Age      = 13;
            obj2.IsLiving = true;

            // Address property isn't included in comparison
            obj1.Address = "123 Oak Ln.";
            obj2.Address = "Nightmare on Elm St.";
            obj1.Equals(obj2).Should().BeTrue();

            obj1.IsLiving = false;
            obj1.Equals(obj2).Should().BeFalse();
        }
        public void CanCompareInheritedDomainObjects()
        {
            var object1 = new InheritedObjectWithExtraDomainSignatureProperty();
            var object2 = new InheritedObjectWithExtraDomainSignatureProperty();

            Assert.That(object1, Is.EqualTo(object2));

            object1.Age      = 13;
            object1.IsLiving = true;
            object2.Age      = 13;
            object2.IsLiving = true;

            // Address property isn't included in comparison
            object1.Address = "123 Oak Ln.";
            object2.Address = "Nightmare on Elm St.";
            Assert.That(object1, Is.EqualTo(object2));

            object1.IsLiving = false;
            Assert.That(object1, Is.Not.EqualTo(object2));
        }