Beispiel #1
0
        private void We_tell_the_comparator_to_use_that_on_a_specific_object_when_comparing_two_lists()
        {
            var aList = new List <ObjectWithValueTypeProperties>
            {
                new ObjectWithValueTypeProperties(),
                new ObjectWithValueTypeProperties(),
                new ObjectWithValueTypeProperties()
            };
            var anotherList = new List <ObjectWithValueTypeProperties>
            {
                new ObjectWithValueTypeProperties(),
                new ObjectWithValueTypeProperties {
                    MyBoolean = true
                },
                new ObjectWithValueTypeProperties {
                    MyBoolean = true
                }
            };

            aList.ShouldNotBeSameAs(anotherList);
            var test = new CharacterizationTest();

            test.Ignore(aList.ElementAt(1), booleanPropertySelector);
            test.Ignore(aList.ElementAt(2), booleanPropertySelector);
            test.CompareObjects(aList, anotherList);
        }
Beispiel #2
0
        private void We_tell_the_comparator_to_use_that_on_all_elements_in_an_IEnumerable_when_comparing()
        {
            var aList = new List <ObjectWithValueTypeProperties>
            {
                new ObjectWithValueTypeProperties(),
                new ObjectWithValueTypeProperties {
                    MyInteger = 1
                },
                new ObjectWithValueTypeProperties {
                    MyInteger = 1
                }
            };
            var anotherList = new List <ObjectWithValueTypeProperties>
            {
                new ObjectWithValueTypeProperties(),
                new ObjectWithValueTypeProperties {
                    MyInteger = 1, MyBoolean = true
                },
                new ObjectWithValueTypeProperties {
                    MyInteger = 1, MyBoolean = true
                }
            };

            aList.ShouldNotBeSameAs(anotherList);
            var test = new CharacterizationTest();

            test.Ignore(aList.Where(o => o.MyInteger == 1), o => o.MyBoolean);
            test.CompareObjects(aList, anotherList);
        }
Beispiel #3
0
        private void We_use_that_lambda_representation_when_we_compare_two_objects_that_differ_on_that_property()
        {
            var someObject    = new ObjectWithValueTypeProperties();
            var anotherObject = new ObjectWithValueTypeProperties {
                MyBoolean = true
            };
            var test = new CharacterizationTest();

            test.IgnoreOnType(booleanPropertySelector);
            test.CompareObjects(someObject, anotherObject);
        }
Beispiel #4
0
        private void We_tell_the_comparator_to_use_that_on_a_specific_object_when_comparing()
        {
            var anObject      = new ObjectWithValueTypeProperties();
            var anotherObject = new ObjectWithValueTypeProperties {
                MyBoolean = true
            };
            var test = new CharacterizationTest();

            test.Ignore(anObject, booleanPropertySelector);
            test.CompareObjects(anObject, anotherObject);
        }
Beispiel #5
0
        private void We_do_the_comparison_on_two_slightly_different_objects_that_are_still_within_range()
        {
            var anObject      = new ObjectWithValueTypeProperties();
            var anotherObject = new ObjectWithValueTypeProperties {
                MyInteger = 9
            };
            var test = new CharacterizationTest();

            test.AllowOnType(integerPropertySelector, integerPropertyComparison);
            test.CompareObjects(anObject, anotherObject);
        }
Beispiel #6
0
        private void We_use_that_lambda_representation_when_we_compare_two_objects_that_differ_on_underlying_properties()
        {
            var someObject = new ObjectWithMixedTypeProperties {
                MySimpleObject = new ObjectWithValueTypeProperties()
            };
            var anotherObject = new ObjectWithMixedTypeProperties
            {
                MySimpleObject = new ObjectWithValueTypeProperties
                {
                    MyBoolean = true,
                    MyDecimal = 1,
                    MyInteger = 1
                }
            };
            var test = new CharacterizationTest();

            test.IgnoreOnType(referenceTypePropertySelector);
            test.CompareObjects(someObject, anotherObject);
        }