Ejemplo n.º 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));
        }
Ejemplo n.º 2
0
        public void VerifyRollbackUndoesChanges()
        {
            Transaction transaction = new EsentTransaction(this.session, "test", null);
            this.InsertRecord(1);
            transaction.Rollback();

            Assert.IsFalse(this.ContainsRecord(1));
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }