public void ClientSettingsHttpTest()
        {
            // Arrange
             var settings = new LegacyClientSettingsModel();
             settings.LegacyClientSubType = LegacyClientSubType.Http;

             _settingsView.Expect(x => x.DataBind(settings));
             _settingsView.Expect(x => x.PathGroupVisible = false);
             _settingsView.Expect(x => x.HttpGroupVisible = true);
             _settingsView.Expect(x => x.FtpGroupVisible = false);
             // Act
             _presenter = CreatePresenter();
             _presenter.SettingsModel = settings;
             // Assert
             _settingsView.VerifyAllExpectations();
        }
      public void ClientSettingsPathTest()
      {
         // Arrange
         var settings = new LegacyClientSettingsModel();
         settings.LegacyClientSubType = LegacyClientSubType.Path;

         _settingsView.Expect(x => x.DataBind(settings));
         _settingsView.Expect(x => x.PathGroupVisible = true);
         _settingsView.Expect(x => x.HttpGroupVisible = false);
         _settingsView.Expect(x => x.FtpGroupVisible = false);
         // Act
         _presenter = CreatePresenter();
         _presenter.SettingsModel = settings;
         // Assert
         // check on default Path instance - no need to replicate this assertion
         Assert.AreSame(settings, _presenter.SettingsModel);

         _settingsView.VerifyAllExpectations();
      }
 public void TestConnectionClickedHttpTest()
 {
     // Arrange
      var settings = new LegacyClientSettingsModel();
      settings.LegacyClientSubType = LegacyClientSubType.Http;
      _networkOps.Expect(x => x.BeginHttpCheckConnection(null, null, null, null)).IgnoreArguments().Return(null);
      // Act
      _presenter = CreatePresenter();
      _presenter.SettingsModel = settings;
      _presenter.TestConnectionClicked();
      // Assert
      _networkOps.VerifyAllExpectations();
 }
 public void ShowDialogTest()
 {
     // Arrange
      _settingsView.Expect(x => x.ShowDialog(null)).Return(DialogResult.OK);
      // Act
      _presenter = CreatePresenter();
      _presenter.ShowDialog(null);
      // Assert
      _settingsView.VerifyAllExpectations();
 }
 public void OkClickedTest()
 {
     // Arrange
      _settingsView.Expect(x => x.DialogResult = DialogResult.OK);
      _settingsView.Expect(x => x.Close());
      // Act
      _presenter = CreatePresenter();
      _presenter.SettingsModel = CreateValidModel();
      _presenter.OkClicked();
      // Assert
      _settingsView.VerifyAllExpectations();
 }
 public void OkClickedPathErrorOkTest()
 {
     // Arrange
      _messageBoxView.Expect(x => x.AskYesNoQuestion(_settingsView, String.Empty, String.Empty)).IgnoreArguments().Return(DialogResult.Yes);
      _settingsView.Expect(x => x.DialogResult = DialogResult.OK);
      _settingsView.Expect(x => x.Close());
      // Act
      _presenter = CreatePresenter();
      _presenter.SettingsModel = CreateValidModel();
      _presenter.SettingsModel.Path = "[";
      _presenter.OkClicked();
      // Assert
      _messageBoxView.VerifyAllExpectations();
      _settingsView.VerifyAllExpectations();
 }
 public void OkClickedErrorTest()
 {
     // Arrange
      _messageBoxView.Expect(x => x.ShowError(_settingsView, String.Empty, String.Empty)).IgnoreArguments();
      // Act
      _presenter = CreatePresenter();
      _presenter.SettingsModel = new LegacyClientSettingsModel();
      _presenter.OkClicked();
      // Assert
      _messageBoxView.VerifyAllExpectations();
 }
        public void LocalBrowseClickedTest()
        {
            // Arrange
             var settings = new LegacyClientSettingsModel();
             settings.Path = "C:\\";
             // Act
             _folderBrowserView.Expect(x => x.SelectedPath = settings.Path);
             _folderBrowserView.Expect(x => x.ShowDialog(_settingsView)).Return(DialogResult.OK);
             _folderBrowserView.Expect(x => x.SelectedPath).Return("D:\\").Repeat.Twice();
             // Assert
             _presenter = CreatePresenter();
             _presenter.SettingsModel = settings;
             _presenter.LocalBrowseClicked();

             Assert.AreEqual("D:\\", settings.Path);

             _folderBrowserView.VerifyAllExpectations();
        }