コード例 #1
0
        public void We_Can_compare_two_string_abs()
        {
            var firstString  = "aeiou";
            var secondString = "aeiou";

            Assert.True(ClassCompared.AbsoluteCompareResult(firstString, secondString));
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        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));
        }
コード例 #4
0
        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));
        }
コード例 #5
0
        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));
        }
コード例 #6
0
        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"
            }));
        }
コード例 #7
0
        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));
        }
コード例 #8
0
        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"
            }));
        }
コード例 #9
0
        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));
        }
コード例 #10
0
        public void If_we_compare_two_diferent_list_of_string_with_AbsoluteCompare_only_get_true_if_all_items_are_equal()
        {
            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.AbsoluteCompareResult(firstListString, secondListString));
            Assert.False(ClassCompared.AbsoluteCompareResult(firstListStringA, secondListStringA));
        }
コード例 #11
0
        public void If_we_compare_emtpty_vs_null_in_compareproperties_we_have_true()
        {
            var firstString = string.Empty;

            Assert.True(ClassCompared.ComparePropertiesResult(firstString, null));
        }
コード例 #12
0
        public void If_we_compare_empty_vs_null_in_absolutecompareresult_we_have_false()
        {
            var firstString = string.Empty;

            Assert.False(ClassCompared.AbsoluteCompareResult(firstString, null));
        }