public void ShowQuestionTest()
        {
            MockMessageService messageService = new MockMessageService();

            string message = "Hello World";

            AssertHelper.ExpectedException <ArgumentNullException>(() => MessageServiceExtensions.ShowQuestion(null, message));
            AssertHelper.ExpectedException <ArgumentNullException>(() => MessageServiceExtensions.ShowYesNoQuestion(null, message));

            bool showQuestionCalled = false;

            messageService.ShowQuestionAction = m =>
            {
                showQuestionCalled = true;
                Assert.AreEqual(message, m);
                return(true);
            };
            Assert.IsTrue(messageService.ShowQuestion(message) == true);
            Assert.IsTrue(showQuestionCalled);

            showQuestionCalled = false;
            messageService.Clear();
            messageService.ShowYesNoQuestionAction = m =>
            {
                showQuestionCalled = true;
                Assert.AreEqual(message, m);
                return(true);
            };
            Assert.IsTrue(messageService.ShowYesNoQuestion(message));
            Assert.IsTrue(showQuestionCalled);
        }
Esempio n. 2
0
 public void ShowQuestionTest_ServiceNull()
 {
     MessageServiceExtensions.ShowQuestion(null, message);
 }