public void Test_DeleteBusinessObject_ConfirmationDelegateUsed_ConfirmedIsTrue_ShouldDeleteBO() { //---------------Set up test pack------------------- var confirmer = new ConfirmerFake(true); var boToDelete = MockRepository.GenerateStub <IBusinessObject>(); var confirmingBusinessObjectDeletor = new ConfirmingBusinessObjectDeletor(confirmer); //---------------Assert Precondition---------------- Assert.IsTrue(confirmer.WillBeConfirmed); //---------------Execute Test ---------------------- confirmingBusinessObjectDeletor.DeleteBusinessObject(boToDelete); //---------------Test Result ----------------------- boToDelete.AssertWasCalled(o => o.MarkForDelete()); }
public void Test_DeleteBusinessObject_ConfirmedIsFalse_ShouldNotDeleteBO() { //---------------Set up test pack------------------- var confirmer = new ConfirmerFake(false); var boToDelete = MockRepository.GenerateStub<IBusinessObject>(); var confirmingBusinessObjectDeletor = new ConfirmingBusinessObjectDeletor(confirmer); //---------------Assert Precondition---------------- Assert.IsFalse(confirmer.WillBeConfirmed); //---------------Execute Test ---------------------- confirmingBusinessObjectDeletor.DeleteBusinessObject(boToDelete); //---------------Test Result ----------------------- boToDelete.AssertWasNotCalled(o => o.MarkForDelete()); }