public void RegisterAuditTypeTwiceExceptionTest() { AuditDbContext context = new AuditDbContext("test"); AuditDbContext.RegisterAuditType(typeof(TestEntity), typeof(TestEntityAudit)); AuditDbContext.RegisterAuditType(typeof(TestEntity), typeof(TestEntityAudit)); }
public void UpdateByAuditTestMethod() { var repository = LocalIoCContainer.Resolve <ISimpleDataEntityRepository>(); Assert.IsTrue(AuditDbContext.AuditEnabled); AuditDbContext.RegisterAuditType(typeof(SimpleDataEntity), typeof(SimpleDataEntityAudit)); var itemToUpdate = repository.Find(2); itemToUpdate.Name = "Updated Name 3"; repository.Update(itemToUpdate, x => x.Id == 2); repository.Save("UserName2"); var actual = repository.Find(2); var auditactual = repository.GetExistingContext().SimpleDataEntityAudits.Where(x => x.AuditSourceId == 2).FirstOrDefault(); Assert.AreEqual("Updated Name 3", actual.Name); Assert.AreEqual("Test 2", auditactual?.Name); Assert.AreEqual("UserName2", auditactual?.AuditUser); repository.Dispose(); }
public void RegisterAuditTypeEntityExceptionTest2() { AuditDbContext context = new AuditDbContext("test"); AuditDbContext.RegisterAuditType(typeof(TestEntity), typeof(TestInvalidAuditEntity)); }
public void RegisterAuditTypeTest() { AuditDbContext context = new AuditDbContext("test"); AuditDbContext.RegisterAuditType(typeof(TestEntityWithComplexType), typeof(TestEntityWithComplexTypeAudit)); }