public void TestUpdateBeforePersistCalled()
        {
            //---------------Set up test pack-------------------
            TransactionCommitterStubDB trnCommitter = new TransactionCommitterStubDB(DatabaseConnection.CurrentConnection);
            bool updateBeforePersistCalled = false;
            MockBOWithUpdateBeforePersistDelegate mockBo = new MockBOWithUpdateBeforePersistDelegate(
                delegate
                {
                    updateBeforePersistCalled = true;
                });
            trnCommitter.AddBusinessObject(mockBo);
            //-------------Assert Preconditions -------------

            //---------------Execute Test ----------------------
            trnCommitter.CommitTransaction();
            //---------------Test Result -----------------------
            Assert.IsTrue(updateBeforePersistCalled);
        }
        public void TestUpdateBeforePersistCalled_ForBoAddedInUpdateBeforePersist()
        {
            //---------------Set up test pack-------------------
            TransactionCommitterStubDB trnCommitter = new TransactionCommitterStubDB(DatabaseConnection.CurrentConnection);
            bool updateBeforePersistCalled = false;
            bool updateBeforePersistCalledForInner = false;
            MockBOWithUpdateBeforePersistDelegate innerMockBo = new MockBOWithUpdateBeforePersistDelegate(
                delegate
                {
                    updateBeforePersistCalledForInner = true;
                });
            MockBOWithUpdateBeforePersistDelegate mockBo = new MockBOWithUpdateBeforePersistDelegate(
                delegate(ITransactionCommitter committer)
                {
                    updateBeforePersistCalled = true;
                    committer.AddBusinessObject(innerMockBo);
                });
            trnCommitter.AddBusinessObject(mockBo);
            //-------------Assert Preconditions -------------
            Assert.AreEqual(1, trnCommitter.GetOriginalTransactions().Count);
            Assert.IsFalse(updateBeforePersistCalled);
            Assert.IsFalse(updateBeforePersistCalledForInner);

            //---------------Execute Test ----------------------
            trnCommitter.CommitTransaction();
            //---------------Test Result -----------------------
            Assert.AreEqual(2, trnCommitter.GetOriginalTransactions().Count);
            Assert.IsTrue(updateBeforePersistCalled);
            Assert.IsTrue(updateBeforePersistCalledForInner);
        }