public void EqualsWithOneNullValueObjectReturnFalse()
        {
            SimpleValueObject vo1 = new SimpleValueObject();
            SimpleValueObject vo2 = null;
            var equality          = Equals(vo1, vo2);

            Assert.AreEqual(false, equality);
        }
        public void EqualsWithEmptyValueObjectsReturnTrue()
        {
            SimpleValueObject vo1 = new SimpleValueObject();
            SimpleValueObject vo2 = new SimpleValueObject();
            var equality          = vo1.Equals(vo2);

            Assert.AreEqual(true, equality);
        }
        public void EqualsWithTwoNullsValueObjectsReturnTrue()
        {
            SimpleValueObject vo1 = null;
            SimpleValueObject vo2 = null;
            var equality          = Equals(vo1, vo2);

            Assert.AreEqual(true, equality);
        }
Example #4
0
        public void EqualsWithTransientObjectsReturnsTrue()
        {
            var obj1 = new SimpleValueObject();
            var obj2 = new SimpleValueObject();

            var equality = Equals(obj1, obj2);

            Assert.Equal(true, equality);
        }
Example #5
0
        public void EqualsWithTwoNullObjectsReturnsTrue()
        {
            const SimpleValueObject obj1 = null;
            const SimpleValueObject obj2 = null;

            var equality = Equals(obj1, obj2);

            Assert.Equal(true, equality);
        }
Example #6
0
        public void EqualsWithNullObjectReturnsFalse()
        {
            const SimpleValueObject obj1 = null;
            var obj2 = new SimpleValueObject();

            var equality = Equals(obj1, obj2);

            Assert.Equal(false, equality);
        }
Example #7
0
        public void SameObjectsTypeDifferentValuesEqualsReturnsFalse4()
        {
            var simpleValueObject = new SimpleValueObject
            {
                Name      = "Name1",
                BirthDate = new DateTime(2016, 1, 15),
                Children  = 3,
                Rate      = 8.9
            };

            _simpleValueObject1.Should().Not.Be.EqualTo(simpleValueObject);
        }
Example #8
0
        public void EqualsWithOneTransientObjectReturnsFalse()
        {
            var obj1 = new SimpleValueObject();
            var obj2 = new SimpleValueObject();

            obj1.SomeText1 = "a";
            obj1.SomeText2 = "b";

            var equality = Equals(obj1, obj2);

            Assert.Equal(false, equality);
        }
        public void EqualsWithOneDifferentPropertyReturnFalse()
        {
            SimpleValueObject vo1 = new SimpleValueObject();
            SimpleValueObject vo2 = new SimpleValueObject();

            vo1.i = 1;
            vo1.s = "string";
            vo2.i = 1;
            vo2.s = "s";

            var equality = vo1.Equals(vo2);

            Assert.AreEqual(false, equality);
        }
        public void EqualsWithEqualsValueObjectsReturnTrue()
        {
            SimpleValueObject vo1 = new SimpleValueObject();
            SimpleValueObject vo2 = new SimpleValueObject();

            vo1.i = 1;
            vo1.s = "string";
            vo2.i = 1;
            vo2.s = "string";

            var equality = vo1.Equals(vo2);

            Assert.AreEqual(true, equality);
        }
Example #11
0
        public void EqualsWithSameIdsPropertyValuesSubclassReturnsFalse()
        {
            var obj1 = new SimpleValueObject();
            var obj2 = new SubSimpleValueObject();

            obj1.SomeText1 = "a";
            obj1.SomeText2 = "b";

            obj2.SomeText1 = "a";
            obj2.SomeText2 = "b";

            var equality = Equals(obj1, obj2);

            Assert.Equal(false, equality);
        }
Example #12
0
        public void EqualsWithSamePropertyValuesReturnsTrue()
        {
            var obj1 = new SimpleValueObject();
            var obj2 = new SimpleValueObject();

            obj1.SomeText1 = "a";
            obj1.SomeText2 = "b";

            obj2.SomeText1 = "a";
            obj2.SomeText2 = "b";

            var equality = Equals(obj1, obj2);

            Assert.Equal(true, equality);
        }
Example #13
0
        public void EqualsWithDifferentPropertyValuesReturnsFalse()
        {
            var obj1 = new SimpleValueObject();
            var obj2 = new SimpleValueObject();

            obj1.SomeText1 = "a";
            obj1.SomeText2 = "b";

            obj2.SomeText1 = "x";
            obj2.SomeText2 = "y";

            var equality = Equals(obj1, obj2);

            Assert.Equal(false, equality);
        }
Example #14
0
        public void EqualsWithSameIdsInDisparateClassesReturnsFalse()
        {
            var obj1 = new SimpleValueObject();
            var obj2 = new OtherSimpleValueObject();

            obj1.SomeText1 = "a";
            obj1.SomeText2 = "b";

            obj2.SomeText1 = "a";
            obj2.SomeText2 = "b";

            var equality = Equals(obj1, obj2);

            Assert.Equal(false, equality);
        }
Example #15
0
 public ValueObjectTests()
 {
     _simpleValueObject1 = new SimpleValueObject
     {
         Name      = "Name1",
         BirthDate = new DateTime(2016, 1, 15),
         Children  = 3,
         Rate      = 7.9
     };
     _simpleValueObject2 = new SimpleValueObject
     {
         Name      = "Name2",
         BirthDate = new DateTime(2016, 2, 1),
         Children  = 2,
         Rate      = 4.9
     };
 }