* EnlistTest.cs: Add tests for bug #82423.
authorAnkit Jain <radical@corewars.org>
Mon, 13 Aug 2007 22:18:20 +0000 (22:18 -0000)
committerAnkit Jain <radical@corewars.org>
Mon, 13 Aug 2007 22:18:20 +0000 (22:18 -0000)
svn path=/trunk/mcs/; revision=84016

mcs/class/System.Transactions/Test/ChangeLog
mcs/class/System.Transactions/Test/EnlistTest.cs

index 9a915825aa8a3bec48af7a61f7a5b593b3bd80ed..a1a08f8534ebf1fe27ef31b76cfa39958aac6ec3 100644 (file)
@@ -1,3 +1,7 @@
+2007-08-14  Ankit Jain  <jankit@novell.com>
+
+       * EnlistTest.cs: Add tests for bug #82423.
+
 2006-03-03  Ankit Jain  <jankit@novell.com>
 
        * AsyncTest.cs:
index ae831000b5bfaeaaf095e71c03d906f0a2c2be2a..1342f2f7c072c155e63a4acfeafffe980305a5bc 100644 (file)
@@ -451,8 +451,57 @@ namespace MonoTests.System.Transactions {
                                scope.Complete ();
                        }
                }
-               #endregion
 
+               [Test]
+               public void TransactionDispose ()
+               {
+                       CommittableTransaction ct = new CommittableTransaction ();
+                       IntResourceManager irm = new IntResourceManager (1);
+                       irm.Volatile = false;
+
+                       ct.Dispose ();
+                       irm.Check  (0, 0, 0, 0, "Dispose transaction");
+               }
+
+               [Test]
+               public void TransactionDispose2 ()
+               {
+                       CommittableTransaction ct = new CommittableTransaction ();
+                       IntResourceManager irm = new IntResourceManager (1);
+
+                       Transaction.Current = ct;
+                       irm.Value = 5;
+
+                       try {
+                               ct.Dispose ();
+                       } finally {
+                               Transaction.Current = null;
+                       }
+
+                       irm.Check (0, 0, 1, 0, "Dispose transaction");
+                       Assert.AreEqual (1, irm.Value);
+               }
+
+               [Test]
+               public void TransactionDispose3 ()
+               {
+                       CommittableTransaction ct = new CommittableTransaction ();
+                       IntResourceManager irm = new IntResourceManager (1);
+
+                       try {
+                               Transaction.Current = ct;
+                               irm.Value = 5;
+                               ct.Commit ();
+                               ct.Dispose ();
+                       } finally {
+                               Transaction.Current = null;
+                       }
+
+                       irm.Check (1, 1, 0, 0, "Dispose transaction");
+                       Assert.AreEqual (5, irm.Value);
+               }
+
+               #endregion
 
        }
 }