public void WhenAuditPersistExceptionOccursTransactionShouldBeRolledBack() { int intId; var willCrash = new NoSchemaEntity(); var intEntity = new IntTestEntity(); using (var tx = Session.BeginTransaction()) { intId = (int)Session.Save(intEntity); Session.Save(willCrash); Assert.Throws <GenericADOException>(tx.Commit); } ForceNewSession(); verifyNoDataGotPeristed(intId); }
public void WhenAuditPersistExceptionOccursTransactionShouldBeRolledBack_FlushModeNever() { int intId; var willCrash = new NoSchemaEntity(); var intEntity = new IntTestEntity(); Session.FlushMode = FlushMode.Never; using (Session.BeginTransaction()) { intId = (int)Session.Save(intEntity); Session.Save(willCrash); Assert.Throws <GenericADOException>(Session.Flush); } verifyNoDataGotPeristed(intId); }