public void InvalidCommit() { DefaultTransactionManager tm = new DefaultTransactionManager(); ITransaction transaction = tm.CreateTransaction( TransactionMode.Requires, IsolationMode.Unspecified); transaction.Begin(); transaction.Rollback(); transaction.Commit(); }
public void SynchronizationsAndRollback() { DefaultTransactionManager tm = new DefaultTransactionManager(); ITransaction transaction = tm.CreateTransaction(TransactionMode.Unspecified, IsolationMode.Unspecified); transaction.Begin(); SynchronizationImpl sync = new SynchronizationImpl(); transaction.RegisterSynchronization(sync); Assert.AreEqual(DateTime.MinValue, sync.Before); Assert.AreEqual(DateTime.MinValue, sync.After); transaction.Rollback(); Assert.IsTrue(sync.Before > DateTime.MinValue); Assert.IsTrue(sync.After > DateTime.MinValue); }
public void SynchronizationsAndCommit() { ITransaction transaction = tm.CreateTransaction(TransactionMode.Unspecified, IsolationMode.Unspecified); transaction.Begin(); SynchronizationImpl sync = new SynchronizationImpl(); transaction.RegisterSynchronization(sync); Assert.AreEqual(DateTime.MinValue, sync.Before); Assert.AreEqual(DateTime.MinValue, sync.After); transaction.Commit(); Assert.IsTrue(sync.Before > DateTime.MinValue); Assert.IsTrue(sync.After > DateTime.MinValue); }
public void NestedRequiresWithCommits() { ITransaction root = tm.CreateTransaction(TransactionMode.Requires, IsolationMode.Unspecified); Assert.IsTrue(root is TransactionBase); root.Begin(); ITransaction child1 = tm.CreateTransaction(TransactionMode.Requires, IsolationMode.Unspecified); Assert.IsTrue(child1 is ChildTransaction); Assert.IsTrue(child1.IsChildTransaction); child1.Begin(); ITransaction child2 = tm.CreateTransaction(TransactionMode.Requires, IsolationMode.Unspecified); Assert.IsTrue(child2 is ChildTransaction); Assert.IsTrue(child2.IsChildTransaction); child2.Begin(); child2.Commit(); child1.Commit(); root.Commit(); }