This is an IBusinessObjectDeletor that uses the specified IConfirmer to prompt the user for confirmation of the deletion. If the user confirms, the BusinessObject will be deleted. If the user does not confirm then the BusinessObject will not be deleted.
Inheritance: IBusinessObjectDeletor
        public void Test_Construct()
        {
            //---------------Set up test pack-------------------
            MockRepository mockRepository = new MockRepository();
            IConfirmer confirmer = mockRepository.StrictMock<IConfirmer>();
            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            ConfirmingBusinessObjectDeletor confirmingBusinessObjectDeletor = new ConfirmingBusinessObjectDeletor(confirmer);
            //---------------Test Result -----------------------
            Assert.IsInstanceOf(typeof(IBusinessObjectDeletor), confirmingBusinessObjectDeletor);
            Assert.AreSame(confirmer, confirmingBusinessObjectDeletor.Confirmer);
        }
        public void Test_Construct_WithCustomConfirmationMessageDelegate()
        {
            //---------------Set up test pack-------------------
            MockRepository mockRepository = new MockRepository();
            IConfirmer confirmer = mockRepository.StrictMock<IConfirmer>();
            Habanero.Util.Function<IBusinessObject, string> customConfirmationMessageDelegate = t => "aaa";
            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            ConfirmingBusinessObjectDeletor confirmingBusinessObjectDeletor = new ConfirmingBusinessObjectDeletor(confirmer, customConfirmationMessageDelegate);
            //---------------Test Result -----------------------
            Assert.IsInstanceOf(typeof(IBusinessObjectDeletor), confirmingBusinessObjectDeletor);
            Assert.AreSame(confirmer, confirmingBusinessObjectDeletor.Confirmer);
            Assert.AreSame(customConfirmationMessageDelegate, confirmingBusinessObjectDeletor.CustomConfirmationMessageDelegate);
        }
 public void Test_DeleteBusinessObject_ConfirmationMessage()
 {
     //---------------Set up test pack-------------------
     MockRepository mockRepository = new MockRepository();
     string boToString = TestUtil.GetRandomString();
     string expectedMessage = string.Format("Are you certain you want to delete the object '{0}'", boToString);
     IConfirmer confirmer = CreateMockConfirmerWithExpectation(mockRepository, 
         Is.Equal(expectedMessage), false);
     IBusinessObject boToDelete = new MockBOWithToString(boToString);
     ConfirmingBusinessObjectDeletor confirmingBusinessObjectDeletor = new ConfirmingBusinessObjectDeletor(confirmer);
     mockRepository.ReplayAll();
     //---------------Assert Precondition----------------
     //---------------Execute Test ----------------------
     confirmingBusinessObjectDeletor.DeleteBusinessObject(boToDelete);
     //---------------Test Result -----------------------
     mockRepository.VerifyAll();
 }
        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());
        }
 public void Test_DeleteBusinessObject_CustomConfirmationMessage()
 {
     //---------------Set up test pack-------------------
     MockRepository mockRepository = new MockRepository();
     string expectedMessage = TestUtil.GetRandomString();
     IConfirmer confirmer = CreateMockConfirmerWithExpectation(mockRepository, 
         Is.Equal(expectedMessage), false);
     IBusinessObject boToDelete = mockRepository.StrictMock<IBusinessObject>();
     ConfirmingBusinessObjectDeletor confirmingBusinessObjectDeletor = 
         new ConfirmingBusinessObjectDeletor(confirmer, t => expectedMessage);
     mockRepository.ReplayAll();
     //---------------Assert Precondition----------------
     //---------------Execute Test ----------------------
     confirmingBusinessObjectDeletor.DeleteBusinessObject(boToDelete);
     //---------------Test Result -----------------------
     mockRepository.VerifyAll();
 }