public void TestPropertiesAfterCreateSaveUpdateAndRefresh() { //0. Create and save the Object T entity = EntityRepository <T> .AddNew(); With.Transaction(delegate { EntityRepository <T> .Save(entity); } ); EntityRepository <T> .Refresh(entity); MakeEntityDirty(entity); With.Transaction(delegate { EntityRepository <T> .Save(entity); } ); EntityRepository <T> .Refresh(entity); Assert.AreEqual(entity.Version, 2); Assert.IsFalse(entity.IsDeleted); /* * Assert.IsNotNull(entity.ModifiedBy); * Assert.IsNotNull(entity.ModifiedOn); */ }
protected static T CreateAndSave() { T entity = EntityRepository <T> .AddNew(); SaveItem(entity); return(entity); }
public void TestUnDeleteNonDeletedCandidate() { TestCandidate candidate = EntityRepository <TestCandidate> .AddNew(); candidate.Name = "Mohan"; Save(candidate); With.Transaction(delegate { EntityRepository <TestCandidate> .UnDelete(candidate); }); }
public virtual T Create() { try { Authorize(Can_Create); return(EntityRepository <T> .AddNew()); } catch (System.Exception ex) { bool reThrow = ExceptionHandler.HandleBusinessLogicLayerException(ex); if (reThrow) { throw; } return(null); } }