public void TransactionResources_AreDisposed() { var t = tm.CreateTransaction(TransactionMode.Requires, IsolationMode.Unspecified); var resource = new ResourceImpl(); t.Enlist(resource); t.Begin(); // lalala t.Rollback(); tm.Dispose(t); Assert.That(resource.wasDisposed); }
public void InvalidDispose1() { ITransaction root = tm.CreateTransaction(TransactionMode.Requires, IsolationMode.Unspecified); root.Begin(); ITransaction child1 = tm.CreateTransaction(TransactionMode.Requires, IsolationMode.Unspecified); child1.Begin(); ITransaction child2 = tm.CreateTransaction(TransactionMode.Requires, IsolationMode.Unspecified); child2.Begin(); tm.Dispose(child1); }
public void TransactionDisposedEvent() { bool transactionDisposedEventTriggered = false; tm.TransactionDisposed += delegate { transactionDisposedEventTriggered = true; }; ITransaction transaction = tm.CreateTransaction( TransactionMode.Requires, IsolationMode.Unspecified); Assert.IsFalse(transactionDisposedEventTriggered); transaction.Begin(); Assert.IsFalse(transactionDisposedEventTriggered); transaction.Commit(); Assert.IsFalse(transactionDisposedEventTriggered); tm.Dispose(transaction); Assert.IsTrue(transactionDisposedEventTriggered); }