Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 3
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);
        }