예제 #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));
        }
예제 #2
0
        public void VerifyCommitPersistsChanges()
        {
            Transaction transaction = new EsentTransaction(this.session, "test", null);
            this.InsertRecord(1);
            transaction.Commit();

            Assert.IsTrue(this.ContainsRecord(1));
        }
예제 #3
0
        public void VerifyCommitOfOuterTransactionCommitsInnerTransaction()
        {
            bool eventCalled = false;

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

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

            Assert.IsTrue(eventCalled);
        }
예제 #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);
        }
예제 #5
0
        public void VerifyCommittedEventIsCalledOnCommit()
        {
            bool eventCalled = false;

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

            Assert.IsTrue(eventCalled);
        }