Exemple #1
0
        public void VerifyCommitThenRollbackUndoesChanges()
        {
            var outerTransaction = new EsentTransaction(this.session, "test", null);
            Transaction innerTransaction = new EsentTransaction(this.session, "test", outerTransaction);

            this.InsertRecord(1);
            innerTransaction.Commit();
            Assert.IsTrue(this.ContainsRecord(1));

            outerTransaction.Rollback();
            Assert.IsFalse(this.ContainsRecord(1));
        }
Exemple #2
0
        public void VerifyRollbackUndoesChanges()
        {
            Transaction transaction = new EsentTransaction(this.session, "test", null);
            this.InsertRecord(1);
            transaction.Rollback();

            Assert.IsFalse(this.ContainsRecord(1));
        }
Exemple #3
0
        public void VerifyRollbackOfOuterTransactionRollsbackInnerTransaction()
        {
            bool eventCalled = false;

            var outerTransaction = new EsentTransaction(this.session, "test", null);
            Transaction innerTransaction = new EsentTransaction(this.session, "test", outerTransaction);

            innerTransaction.RolledBack += () => eventCalled = true;
            outerTransaction.Rollback();

            Assert.IsTrue(eventCalled);
        }
Exemple #4
0
        public void VerifyRolledBackEventMigratesToOuterTransactionOnCommit()
        {
            bool eventCalled = false;

            var outerTransaction = new EsentTransaction(this.session, "test", null);
            Transaction innerTransaction = new EsentTransaction(this.session, "test", outerTransaction);

            innerTransaction.RolledBack += () => eventCalled = true;
            innerTransaction.Commit();
            outerTransaction.Rollback();

            Assert.IsTrue(eventCalled);
        }
Exemple #5
0
        public void VerifyRolledBackEventIsCalledOnRollback()
        {
            bool eventCalled = false;

            Transaction transaction = new EsentTransaction(this.session, "test", null);
            transaction.RolledBack += () => eventCalled = true;
            transaction.Rollback();

            Assert.IsTrue(eventCalled);
        }