public void LoggableEntity_CreatesPropertiesForModifiedEntity() { String title = model.Title; entry.State = EntityState.Modified; entry.CurrentValues["Title"] = "Role"; entry.OriginalValues["Title"] = "Role"; LoggableProperty expected = new LoggableProperty(entry.Property("Title"), title); LoggableProperty actual = new LoggableEntity(entry).Properties.Single(); Assert.Equal(expected.IsModified, actual.IsModified); Assert.Equal(expected.ToString(), actual.ToString()); }
public void LoggableEntity_CreatesPropertiesForAttachedEntity() { context.Dispose(); String title = model.Title; context = new TestingContext(); context.Set <TestModel>().Attach(model); entry = context.Entry <BaseModel>(model); entry.OriginalValues["Title"] = "Role"; entry.CurrentValues["Title"] = "Role"; entry.State = EntityState.Modified; LoggableProperty expected = new LoggableProperty(entry.Property("Title"), title); LoggableProperty actual = new LoggableEntity(entry).Properties.Single(); Assert.Equal(expected.IsModified, actual.IsModified); Assert.Equal(expected.ToString(), actual.ToString()); }