public void ShowMessageTest() { var messageService = new MockMessageService(); var view = new object(); var message = "Hello World"; var format = "Result: {0}"; AssertHelper.ExpectedException <ArgumentNullException>(() => MessageServiceExtensions.ShowMessage(null !, message)); AssertHelper.ExpectedException <ArgumentNullException>(() => MessageServiceExtensions.ShowMessage(null !, null, message)); AssertHelper.ExpectedException <ArgumentNullException>(() => MessageServiceExtensions.ShowWarning(null !, message)); AssertHelper.ExpectedException <ArgumentNullException>(() => MessageServiceExtensions.ShowWarning(null !, null, message)); AssertHelper.ExpectedException <ArgumentNullException>(() => MessageServiceExtensions.ShowError(null !, message)); AssertHelper.ExpectedException <ArgumentNullException>(() => MessageServiceExtensions.ShowError(null !, null, message)); messageService.ShowMessage(message); Assert.AreEqual(MessageType.Message, messageService.MessageType); Assert.AreEqual(message, messageService.Message); messageService.Clear(); messageService.ShowMessage(view, format, 42); Assert.AreSame(view, messageService.Owner); Assert.AreEqual(MessageType.Message, messageService.MessageType); Assert.AreEqual(string.Format(CultureInfo.CurrentCulture, format, 42), messageService.Message); messageService.Clear(); messageService.ShowWarning(message); Assert.AreEqual(MessageType.Warning, messageService.MessageType); Assert.AreEqual(message, messageService.Message); messageService.Clear(); messageService.ShowWarning(view, format, 42); Assert.AreSame(view, messageService.Owner); Assert.AreEqual(MessageType.Warning, messageService.MessageType); Assert.AreEqual(string.Format(CultureInfo.CurrentCulture, format, 42), messageService.Message); messageService.Clear(); messageService.ShowError(message); Assert.AreEqual(MessageType.Error, messageService.MessageType); Assert.AreEqual(message, messageService.Message); messageService.Clear(); messageService.ShowError(view, format, 42); Assert.AreSame(view, messageService.Owner); Assert.AreEqual(MessageType.Error, messageService.MessageType); Assert.AreEqual(string.Format(CultureInfo.CurrentCulture, format, 42), messageService.Message); }
public void ShowMessageTest() { MockMessageService messageService = new MockMessageService(); string message = "Hello World"; AssertHelper.ExpectedException<ArgumentNullException>(() => MessageServiceExtensions.ShowMessage(null, message)); AssertHelper.ExpectedException<ArgumentNullException>(() => MessageServiceExtensions.ShowWarning(null, message)); AssertHelper.ExpectedException<ArgumentNullException>(() => MessageServiceExtensions.ShowError(null, message)); messageService.ShowMessage(message); Assert.AreEqual(MessageType.Message, messageService.MessageType); Assert.AreEqual(message, messageService.Message); messageService.Clear(); messageService.ShowWarning(message); Assert.AreEqual(MessageType.Warning, messageService.MessageType); Assert.AreEqual(message, messageService.Message); messageService.Clear(); messageService.ShowError(message); Assert.AreEqual(MessageType.Error, messageService.MessageType); Assert.AreEqual(message, messageService.Message); }
public void ShowMessageTest() { var messageService = new MockMessageService(); var message = "Hello World"; AssertHelper.ExpectedException <ArgumentNullException>(() => MessageServiceExtensions.ShowMessage(null !, message)); AssertHelper.ExpectedException <ArgumentNullException>(() => MessageServiceExtensions.ShowWarning(null !, message)); AssertHelper.ExpectedException <ArgumentNullException>(() => MessageServiceExtensions.ShowError(null !, message)); messageService.ShowMessage(message); Assert.AreEqual(MessageType.Message, messageService.MessageType); Assert.AreEqual(message, messageService.Message); messageService.Clear(); messageService.ShowWarning(message); Assert.AreEqual(MessageType.Warning, messageService.MessageType); Assert.AreEqual(message, messageService.Message); messageService.Clear(); messageService.ShowError(message); Assert.AreEqual(MessageType.Error, messageService.MessageType); Assert.AreEqual(message, messageService.Message); }