public void TestMultiTransactionsWithRollback() { using (ISessionProvider provider = new SessionContextProvider(this.SessionFactory.OpenSession)) { provider.BeginTransaction("first"); Assert.IsTrue(provider.InProgress); provider.BeginTransaction("second"); Assert.IsTrue(provider.InProgress); provider.BeginTransaction("third"); Assert.IsTrue(provider.InProgress); provider.CommitTransaction(); /* commit the third transaction. */ Assert.IsTrue(provider.InProgress); provider.RollbackTransaction(); /* this throws an exception because there are another inner transaction in progress. */ } }
public void TestMultiTransactions() { using (ISessionProvider provider = new SessionContextProvider(this.SessionFactory.OpenSession)) { provider.BeginTransaction("first"); Assert.IsTrue(provider.InProgress); provider.BeginTransaction("second"); Assert.IsTrue(provider.InProgress); provider.BeginTransaction("third"); Assert.IsTrue(provider.InProgress); provider.CommitTransaction(); Assert.IsTrue(provider.InProgress); provider.CommitTransaction(); Assert.IsTrue(provider.InProgress); provider.CommitTransaction(); Assert.IsFalse(provider.InProgress); } }