public void VerifyThatGetPropertyByNameWorks() { var usernameProperty = typeof(DeletedThing).GetProperty("ModifiedOn"); var user = new DeletedThing(); Assert.AreEqual(usernameProperty, user.GetPropertyInfoFromName("ModifiedOn")); }
public void DeleteRecord(IEntityObject thing, object transaction = null) { var uuid = thing.GetType().GetProperty(thing.PrimaryKey).GetValue(thing) as Guid?; this.Cache.Remove((Guid)uuid); this.ThingCache.Remove((Guid)uuid); var deletedThing = new DeletedThing() { Uuid = (Guid)uuid, ModifiedOn = DateTime.UtcNow }; this.DeletedThingCache.Add((Guid)uuid, deletedThing); return; }
public void VerifyThatDeletedThingCanBeCreated() { var uuid = Guid.NewGuid(); var modifiedOn = DateTime.Now; var thing = new DeletedThing() { Uuid = uuid, ModifiedOn = modifiedOn }; var thing2 = new DeletedThing(Guid.NewGuid()); Assert.AreEqual(uuid, thing.Uuid); Assert.AreEqual(modifiedOn, thing.ModifiedOn); Assert.Throws <InvalidOperationException>(() => thing.Save()); Assert.Throws <InvalidOperationException>(() => thing.Delete()); }