Пример #1
0
        public void CanCompareDomainObjectsWithAllPropertiesBeingPartOfDomainSignature()
        {
            var obj1 = new ObjectWithAllDomainSignatureProperty();
            var obj2 = new ObjectWithAllDomainSignatureProperty();

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

            obj1.Age  = 13;
            obj2.Age  = 13;
            obj1.Name = "Foo";
            obj2.Name = "Foo";
            obj1.Equals(obj2).Should().BeTrue();

            obj1.Name = "Bar";
            obj1.Equals(obj2).Should().BeFalse();

            obj1.Name = null;
            obj1.Equals(obj2).Should().BeFalse();

            obj2.Name = null;
            obj1.Equals(obj2).Should().BeTrue();
        }
        public void CanCompareDomainObjectsWithAllPropertiesBeingPartOfDomainSignature()
        {
            var object1 = new ObjectWithAllDomainSignatureProperty();
            var object2 = new ObjectWithAllDomainSignatureProperty();

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

            object1.Age  = 13;
            object2.Age  = 13;
            object1.Name = "Foo";
            object2.Name = "Foo";
            Assert.That(object1, Is.EqualTo(object2));

            object1.Name = "Bar";
            Assert.That(object1, Is.Not.EqualTo(object2));

            object1.Name = null;
            Assert.That(object1, Is.Not.EqualTo(object2));

            object2.Name = null;
            Assert.That(object1, Is.EqualTo(object2));
        }