private Dict GetChanges(Bean bean) { var changes = new Dict(); var dirtyNames = bean.GetDirtyNames(); if (dirtyNames.Any()) { foreach (var dirtyKey in bean.GetDirtyNames()) { changes[dirtyKey] = bean[dirtyKey]; } } return(changes); }
public void GetDrityNames() { var bean = new Bean(); Assert.Empty(bean.GetDirtyNames()); bean["a"] = 1; AssertExtensions.Equivalent(new[] { "a" }, bean.GetDirtyNames()); bean["a"] = null; Assert.Empty(bean.GetDirtyNames()); bean["a"] = 1; bean.ForgetDirtyBackup(); Assert.Empty(bean.GetDirtyNames()); bean["a"] = null; AssertExtensions.Equivalent(new[] { "a" }, bean.GetDirtyNames()); }