Ejemplo n.º 1
0
        public void ArePropertiesEqual_All_Propertes_Is_Equal_InnerObjects_Are_Equal_If_Requested_Consideration()
        {
            var expected = new MyTestObject
            {
                Id          = 1,
                Description = "Description Equal",
                InnerObject = new MyTestInnerObject
                {
                    InnerId = 1
                }
            };

            var actual = new MyTestObject
            {
                Id          = 1,
                Description = "Description Equal",
                InnerObject = new MyTestInnerObject
                {
                    InnerId = 1
                }
            };

            var compareOption = new ObjectComparer.ComparisonOptions {
                ShouldRecursivelyCompareSubProperties = true
            };
            var result = ObjectComparer.ArePropertiesEqual(expected, actual, compareOption);

            Assert.True(result);
        }
Ejemplo n.º 2
0
        public void ArePropertiesEqual_All_Propertes_Is_Equal_InnerObjects_Not_Considerred_Equal_By_Default()
        {
            var expected = new MyTestObject
            {
                Id          = 1,
                Description = "Description Equal",
                InnerObject = new MyTestInnerObject
                {
                    InnerId = 1
                }
            };

            var actual = new MyTestObject
            {
                Id          = 1,
                Description = "Description Equal",
                InnerObject = new MyTestInnerObject
                {
                    InnerId = 1
                }
            };

            var result = ObjectComparer.ArePropertiesEqual(expected, actual);

            Assert.False(result);
        }
Ejemplo n.º 3
0
        public void ArePropertiesEqual_All_Propertes_Is_Equal()
        {
            var expected = new MyTestObject
            {
                Id          = 1,
                Description = "Description Equal"
            };

            var actual = new MyTestObject
            {
                Id          = 1,
                Description = "Description Equal"
            };

            var result = ObjectComparer.ArePropertiesEqual(expected, actual);

            Assert.True(result);
        }
Ejemplo n.º 4
0
        public void ArePropertiesEqual_One_Property_Is_Not_Equal()
        {
            var expected = new MyTestObject
            {
                Id          = 1,
                Description = "Description"
            };

            var actual = new MyTestObject
            {
                Id          = 1,
                Description = "Description Not Equal"
            };

            var result = ObjectComparer.ArePropertiesEqual(expected, actual);

            Assert.False(result);
        }