public void If_we_compare_two_diferent_int_we_get_always_false()
        {
            int?firstInt  = 5;
            int?secondInt = 0;

            Assert.False(ClassCompared.ComparePropertiesResult(firstInt, secondInt));
            Assert.False(ClassCompared.AbsoluteCompareResult(firstInt, secondInt));
            Assert.False(ClassCompared.ComparePropertiesResult(null, secondInt));
            Assert.False(ClassCompared.AbsoluteCompareResult(null, secondInt));
        }
        public void In_CompareProperties_one_list_initialized_vs_not_initialized_will_get_false()
        {
            var oneComplexClass = new ClassToCompare()
            {
                ontInt = 5, oneString = "", oneStringList = new List <string>()
            };
            var twoComplexClass = new ClassToCompare()
            {
                ontInt = 5, oneString = "",
            };

            Assert.False(ClassCompared.ComparePropertiesResult(oneComplexClass, twoComplexClass));
        }
        public void In_CompareProperties_one_list_initialized_vs_not_initialized_will_get_false_but_we_can_Exclude_it_and_get_true()
        {
            var oneComplexClass = new ClassToCompare()
            {
                ontInt = 5, oneString = "", oneStringList = new List <string>()
            };
            var twoComplexClass = new ClassToCompare()
            {
                ontInt = 5, oneString = "",
            };

            Assert.True(ClassCompared.ComparePropertiesResult(oneComplexClass, twoComplexClass, new List <string>()
            {
                "oneStringList"
            }));
        }
        public void In_CompareProperties_we_can_exclude_from_compare_all_properties()
        {
            var oneComplexClass = new ClassToCompare()
            {
                ontInt = 9, oneString = "test", otherString = "diff", oneStringList = new List <string>()
                {
                    "one"
                }
            };
            var twoComplexClass = new ClassToCompare()
            {
                ontInt = 5, oneString = "", otherString = "test"
            };

            Assert.True(ClassCompared.ComparePropertiesResult(oneComplexClass, twoComplexClass, new List <string>()
            {
                "ontInt", "oneString", "otherString", "oneStringList"
            }));
        }
        public void If_we_compare_two_diferent_list_of_string_with_CompareProperties_only_get_true_if_all_items_are_equal_or_one_is_null_and_other_is_empty()
        {
            var firstListString = new List <string>()
            {
                "a", "ei", "ou"
            };
            var secondListString = new List <string>()
            {
                "a", "ei", "ou"
            };
            var firstListStringA = new List <string>()
            {
                "a", "ei", "ou", string.Empty
            };
            var secondListStringA = new List <string>()
            {
                "a", "ei", "ou", null
            };

            Assert.True(ClassCompared.ComparePropertiesResult(firstListString, secondListString));
            Assert.True(ClassCompared.ComparePropertiesResult(firstListStringA, secondListStringA));
        }
        public void DefaultComplexType_with_diferent_properties_initialiced_can_be_compare_with_both_methods_wiht_diferent_result_if_in_compareproperties_exclude_propertie_that_are_diferent()
        {
            var oneComplexClass = new ClassToCompare()
            {
                ontInt = 5, oneString = "test"
            };
            var twoComplexClass = new ClassToCompare()
            {
                ontInt = 5, otherString = "test"
            };

            Assert.NotEqual(ClassCompared.AbsoluteCompareResult(oneComplexClass, twoComplexClass), ClassCompared.ComparePropertiesResult(oneComplexClass, twoComplexClass, new List <string>()
            {
                "oneString", "otherString"
            }));
            Assert.False(ClassCompared.AbsoluteCompareResult(oneComplexClass, twoComplexClass));
        }
        public void DefaultComplexType_with_diferent_properties_initialiced_can_be_compare_with_both_methods_wiht_same_result()
        {
            var oneComplexClass = new ClassToCompare()
            {
                ontInt = 5, oneString = "test"
            };
            var twoComplexClass = new ClassToCompare()
            {
                ontInt = 5, otherString = "test"
            };

            Assert.Equal(ClassCompared.AbsoluteCompareResult(oneComplexClass, twoComplexClass), ClassCompared.ComparePropertiesResult(oneComplexClass, twoComplexClass));
            Assert.False(ClassCompared.AbsoluteCompareResult(oneComplexClass, twoComplexClass));
        }
        public void DefaultComplexType_can_be_compare_with_both_methods_wiht_same_result()
        {
            var oneComplexClass = new ClassToCompare();
            var twoComplexClass = new ClassToCompare();

            Assert.Equal(ClassCompared.AbsoluteCompareResult(oneComplexClass, twoComplexClass), ClassCompared.ComparePropertiesResult(oneComplexClass, twoComplexClass));
            Assert.True(ClassCompared.AbsoluteCompareResult(oneComplexClass, twoComplexClass));
        }
        public void If_we_compare_emtpty_vs_null_in_compareproperties_we_have_true()
        {
            var firstString = string.Empty;

            Assert.True(ClassCompared.ComparePropertiesResult(firstString, null));
        }