// Clients Menu Handling Methods
 public void ClientsAddClick(FahClientSettingsPresenterFactory presenterFactory)
 {
     using (var dialog = presenterFactory.Create(new FahClientSettingsModel()))
     {
         while (dialog.ShowDialog(Form) == DialogResult.OK)
         {
             var settings = dialog.Model.ClientSettings;
             try
             {
                 ClientConfiguration.Add(settings);
                 break;
             }
             catch (ArgumentException ex)
             {
                 Logger.Error(ex.Message, ex);
                 MessageBox.ShowError(Form, ex.Message, Core.Application.NameAndVersion);
             }
         }
     }
 }
Exemple #2
0
        public void LoadTest2()
        {
            // Arrage
            var settingsCollection = new[] { new ClientSettings(ClientType.Legacy)
                                             {
                                                 Name = "test"
                                             } };

            _factory.Expect(x => x.CreateCollection(settingsCollection)).Return(new[] { new LegacyClient {
                                                                                            Settings = settingsCollection[0]
                                                                                        } });
            // Act
            Assert.IsFalse(_clientConfiguration.IsDirty);
            _clientConfiguration.Add("test", new LegacyClient());
            Assert.IsTrue(_clientConfiguration.IsDirty);
            _clientConfiguration.Load(settingsCollection);
            // Assert
            Assert.IsFalse(_clientConfiguration.IsDirty);
            _factory.VerifyAllExpectations();
        }