public void Apply_flat_property() { string before = "1"; string after = "2"; MockEntity entity = new MockEntity(); entity.StringProperty = before; PropertyChange change = new PropertyChange(".", "StringProperty", string.Empty, before, after, entity.State); change.Apply(entity); Assert.AreEqual(after, entity.StringProperty); }
public void Apply_collection_property_added() { MockEntity entity = new MockEntity(); MockEntity relationalEntity = new MockEntity(); string entityPath = ".RelationalEntities[Guid=" + relationalEntity.Guid + "]"; PropertyChange change = new PropertyChange(entityPath, string.Empty, string.Empty, null, relationalEntity); change.Apply(entity); Assert.AreEqual(1, entity.RelationalEntities.Count); Assert.AreEqual(relationalEntity, entity.RelationalEntities.Single()); }
public void Apply_flat_property_relational_property() { string before = null; string after = "Changed"; MockEntity entity = new MockEntity(); entity.RelationalEntity1 = new MockEntity() { StringProperty = before }; PropertyChange change = new PropertyChange(".RelationalEntity1", "StringProperty", string.Empty, before, after, entity.State); change.Apply(entity); Assert.AreEqual(after, entity.RelationalEntity1.StringProperty); }