コード例 #1
0
        public void Test_DeleteBusinessObject_Success()
        {
            //---------------Set up test pack-------------------
            ITransactionCommitter transactionCommitter  = GetTransactionCommitter();
            IBusinessObject       boToDelete            = MockRepository.GenerateMock <IBusinessObject>();
            DefaultBODeletor      businessObjectDeletor = new DefaultBODeletor();

            //---------------Assert Precondition----------------
            Assert.IsNotNull(transactionCommitter);
            transactionCommitter.AssertWasNotCalled(committer => committer.CommitTransaction());
            //---------------Execute Test ----------------------
            businessObjectDeletor.DeleteBusinessObject(boToDelete);
            //---------------Test Result -----------------------
            boToDelete.AssertWasCalled(o => o.MarkForDelete());
            transactionCommitter.AssertWasCalled(committer => committer.CommitTransaction());
            boToDelete.AssertWasNotCalled(o => o.CancelEdits());
        }