public void FahClientSettingsPresenter_OKClicked_SetsDialogResultAndClosesDialogWhenModelHasNoError() { // Arrange using (var presenter = new MockDialogFahClientSettingsPresenter(new FahClientSettingsModel { Name = "foo", Server = "bar" })) { presenter.ShowDialog(null); Assert.IsTrue(presenter.MockDialog.Shown); // Act presenter.OKClicked(); // Assert Assert.AreEqual(DialogResult.OK, presenter.Dialog.DialogResult); Assert.IsFalse(presenter.MockDialog.Shown); } }
public void FahClientSettingsPresenter_OKClicked_ShowsMessageBoxWhenModelHasError() { // Arrange var messageBox = new MockMessageBoxPresenter(); using (var presenter = new MockDialogFahClientSettingsPresenter(new FahClientSettingsModel(), messageBox)) { presenter.ShowDialog(null); Assert.IsTrue(presenter.MockDialog.Shown); // Act presenter.OKClicked(); // Assert Assert.AreEqual(1, messageBox.Invocations.Count); Assert.IsTrue(presenter.MockDialog.Shown); } }