public void AssertDifference_should_error_if_any_propertiesToIgnore_is_redundant() { var obj1 = new TestClass() { Value1 = "1", Value2 = "2", Composite = new TestClass() { Value1 = "111" } }; var obj2 = new TestClass() { Value1 = "2", Value2 = "3", Composite = new TestClass() { Value1 = "222" } }; var comparer = new ObjectComparer(); comparer.AssertDifference(obj1, obj2, new[] { "/Composite/Value2 - null", "/Composite/Composite - null", "redundant property to ignore" }); }
public void AssertDifference_test() { var obj1 = new TestClass() { Value1 = "1", Value2 = "2", Field1 = "3", Composite = new TestClass() { Value1 = "111" } }; obj1.Dict.Add("a", "value1"); var obj2 = new TestClass() { Value1 = "2", Value2 = "3", Field1 = "4", Composite = new TestClass() { Value1 = "222"}}; obj2.Dict.Add("a", "value2"); var comparer = new ObjectComparer(); comparer.AssertDifference(obj1, obj2, new[] { "/Composite/Value2 - null", "/Composite/Composite - null", "/Composite/Dict - no elements found", "/Composite/Field1 - null" }); }
public void Source_property_change_should_result_in_destination_property_change() { var setter = new SampleValueSetter(); var comparer = new ObjectComparer(); var viewModelFactory = new SampleViewModelFactory(); var domainModel1 = new SampleDomainModel(); setter.AssignSampleValues(domainModel1, 0); var viewModel1 = viewModelFactory.Build(domainModel1); var domainModel2 = new SampleDomainModel(); setter.AssignSampleValues(domainModel2, 1); var viewModel2 = viewModelFactory.Build(domainModel2); comparer.AssertDifference(viewModel1, viewModel2, new [] { "/StaticValue - static value" }); }