private IControlFactory SetupControlFactoryMockWithExpectation(MockRepository mockRepository, string message, string title, MessageBoxIcon messageBoxIcon, DialogResult dialogResultToReturn)
        {
            IControlFactory controlFactory = mockRepository.StrictMock <IControlFactory>();

            controlFactory.Expect(
                factory => factory.ShowMessageBox(message, title, MessageBoxButtons.YesNo, messageBoxIcon))
            .Return(dialogResultToReturn);
            return(controlFactory);
        }
        private IControlFactory SetupControlFactoryMockWithExpectationWithDelegate(
            MockRepository mockRepository, string message, string title,
            MessageBoxIcon messageBoxIcon, DialogResult dialogResultToReturn,
            ConfirmationDelegate confirmationDelegate)
        {
            IControlFactory controlFactory = mockRepository.StrictMock <IControlFactory>();

            controlFactory.Expect(
                factory => factory.ShowMessageBox(null, null, MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Asterisk, null))
            .Return(dialogResultToReturn).Constraints(
                Is.Equal(message), Is.Equal(title), Is.Equal(MessageBoxButtons.YesNo),
                Is.Equal(messageBoxIcon), Is.Anything())
            .WhenCalled(invocation => confirmationDelegate(dialogResultToReturn == DialogResult.Yes));
            return(controlFactory);
        }