public void GetChanges_dictionary_withIgnored() { var oldState = new DictionaryVictim { Dictionary = new Dictionary <string, int> { { "one", 11 }, { "two", 22 } } }; var newState = new DictionaryVictim { Dictionary = new Dictionary <string, int> { { "one", 33 }, { "five", 55 } } }; worker.FindDifferences ( oldState, newState, stateChanges, 5, (field, context) => false, (prop, context) => context.BreadcrumbAsString.Equals("Dictionary[two]") ); Assert.Equal(2, stateChanges.Changes.Count); var change = stateChanges.Changes[0]; Assert.Equal("Dictionary[one]", change.Breadcrumb); Assert.Equal(11, change.OldValue); Assert.Equal(33, change.NewValue); change = stateChanges.Changes[1]; Assert.Equal("Dictionary[five]", change.Breadcrumb); Assert.Equal(null, change.OldValue); Assert.Equal(55, change.NewValue); }
public void GetChanges_dictionary() { var oldState = new DictionaryVictim { Dictionary = new Dictionary <string, int> { { "one", 11 }, { "two", 22 } } }; var newState = new DictionaryVictim { Dictionary = new Dictionary <string, int> { { "one", 33 }, { "five", 55 } } }; worker.FindDifferences(oldState, newState, stateChanges, 5); Assert.Equal(3, stateChanges.Changes.Count); var change = stateChanges.Changes[0]; Assert.Equal("Dictionary[one]", change.Breadcrumb); Assert.Equal(11, change.OldValue); Assert.Equal(33, change.NewValue); change = stateChanges.Changes[1]; Assert.Equal("Dictionary[two]", change.Breadcrumb); Assert.Equal(22, change.OldValue); Assert.Equal(null, change.NewValue); change = stateChanges.Changes[2]; Assert.Equal("Dictionary[five]", change.Breadcrumb); Assert.Equal(null, change.OldValue); Assert.Equal(55, change.NewValue); }