Inheritance: ISynchronization
        public void SynchronizationsAndRollback_NestedTransaction()
        {
            ITransaction root =
                tm.CreateTransaction(TransactionMode.Requires, IsolationMode.Unspecified);

            Assert.IsTrue(root is TalkactiveTransaction);
            root.Begin();

            ITransaction child1 = tm.CreateTransaction(TransactionMode.Requires, IsolationMode.Unspecified);

            Assert.IsTrue(child1 is ChildTransaction);
            Assert.IsTrue(child1.IsChildTransaction);
            child1.Begin();

            SynchronizationImpl sync = new SynchronizationImpl();

            child1.RegisterSynchronization(sync);

            Assert.AreEqual(DateTime.MinValue, sync.Before);
            Assert.AreEqual(DateTime.MinValue, sync.After);

            child1.Rollback();
            root.Rollback();

            Assert.IsTrue(sync.Before > DateTime.MinValue);
            Assert.IsTrue(sync.After > DateTime.MinValue);
        }
Esempio n. 2
0
        public void SynchronizationsAndRollback_RegistredAfter_CommitOrRollBack_AreStarted()
        {
            var t =
                tm.CreateTransaction(TransactionMode.Unspecified, IsolationMode.Unspecified);

            t.Begin();

            var sync = new SynchronizationImpl();

            t.RegisterSynchronization(sync);

            Assert.AreEqual(DateTime.MinValue, sync.Before);
            Assert.AreEqual(DateTime.MinValue, sync.After);

            t.Rollback();

            Assert.IsTrue(sync.Before > DateTime.MinValue);
            Assert.IsTrue(sync.After > DateTime.MinValue);
        }
Esempio n. 3
0
        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 SynchronizationsAndRollback()
		{
			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 SynchronizationsAndRollback_RegistredAfter_CommitOrRollBack_AreStarted()
		{
			var t = 
				tm.CreateTransaction(TransactionMode.Unspecified, IsolationMode.Unspecified);

			t.Begin();
	
			var sync = new SynchronizationImpl();

			t.RegisterSynchronization( sync );

			Assert.AreEqual( DateTime.MinValue, sync.Before );
			Assert.AreEqual( DateTime.MinValue, sync.After );

			t.Rollback();

			Assert.IsTrue( sync.Before > DateTime.MinValue );
			Assert.IsTrue( sync.After > DateTime.MinValue );
		}
Esempio n. 6
0
        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 SynchronizationsAndRollback_NestedTransaction()
		{
			ITransaction root =
				tm.CreateTransaction(TransactionMode.Requires, IsolationMode.Unspecified);
			Assert.IsTrue(root is TalkactiveTransaction);
			root.Begin();

			ITransaction child1 = tm.CreateTransaction(TransactionMode.Requires, IsolationMode.Unspecified);
			Assert.IsTrue(child1 is ChildTransaction);
			Assert.IsTrue(child1.IsChildTransaction);
			child1.Begin();

			SynchronizationImpl sync = new SynchronizationImpl();

			child1.RegisterSynchronization(sync);

			Assert.AreEqual(DateTime.MinValue, sync.Before);
			Assert.AreEqual(DateTime.MinValue, sync.After);

			child1.Rollback();
			root.Rollback();

			Assert.IsTrue(sync.Before > DateTime.MinValue);
			Assert.IsTrue(sync.After > DateTime.MinValue);
		}