Beispiel #1
0
        public void FahClientSettingsPresenter_ConnectClicked_AttemptsConnectionAndShowsMessageBoxOnFailure()
        {
            // Arrange
            var messageBox = new MockMessageBoxPresenter();

            using (var presenter = new MockDialogFahClientSettingsPresenter(new FahClientSettingsModel {
                Name = "foo", Server = "bar"
            }, messageBox))
            {
                // Act
                presenter.ConnectClicked();
                // Assert
                Assert.AreEqual(1, messageBox.Invocations.Count);
            }
        }
Beispiel #2
0
 public void FahClientSettingsPresenter_ConnectClicked_ConnectsWhenModelHasNoError()
 {
     // Arrange
     using (var connection = new MockFahClientConnectionWithMessages())
     {
         var model = new MockConnectionFahClientSettingsModel(connection)
         {
             Name = "foo", Server = "bar"
         };
         using (var presenter = new MockDialogFahClientSettingsPresenter(model))
         {
             // Act
             presenter.ConnectClicked();
             // Assert
             Assert.IsNotNull(presenter.Connection);
             Assert.IsTrue(presenter.Connection.Connected);
             Assert.AreEqual(1, presenter.Model.Slots.Count);
         }
     }
 }
Beispiel #3
0
        public void FahClientSettingsPresenter_ConnectClicked_ConnectsAndShowsMessageBoxWhenFahClientReaderFailsToRead()
        {
            // Arrange
            var messageBox = new MockMessageBoxPresenter();

            using (var connection = new MockFahClientConnection())
            {
                var model = new MockConnectionFahClientSettingsModel(connection)
                {
                    Name = "foo", Server = "bar"
                };
                using (var presenter = new MockDialogFahClientSettingsPresenter(model, messageBox))
                {
                    // Act
                    presenter.ConnectClicked();
                    // Assert
                    Assert.AreEqual(1, messageBox.Invocations.Count);
                    Assert.IsNotNull(presenter.Connection);
                    Assert.IsFalse(presenter.Connection.Connected);
                    Assert.IsTrue(presenter.Model.ConnectEnabled);
                    Assert.AreEqual(0, presenter.Model.Slots.Count);
                }
            }
        }