public void ClientSettingsManager_Read_ReturnsClientSettingsCollectionAndSetsManagerState()
        {
            // Arrange
            var manager = new ClientSettingsManager();
            // Act
            var settings = manager.Read("..\\..\\TestFiles\\TestClientSettings.hfmx", 1);

            // Assert
            Assert.IsNotNull(settings);
            Assert.AreEqual(1, settings.Count());
            Assert.AreEqual("..\\..\\TestFiles\\TestClientSettings.hfmx", manager.FileName);
            Assert.AreEqual(1, manager.FilterIndex);
            Assert.AreEqual(".hfmx", manager.FileExtension);
        }
예제 #2
0
        private void LoadConfigFile(string filePath, int filterIndex = 1)
        {
            Debug.Assert(filePath != null);

            try
            {
                // Read the config file
                _clientConfiguration.Load(_settingsManager.Read(filePath, filterIndex));

                if (_clientConfiguration.Count == 0)
                {
                    _messageBoxView.ShowError(_view, "No client configurations were loaded from the given config file.", _view.Text);
                }
            }
            catch (Exception ex)
            {
                Logger.ErrorFormat(ex, "{0}", ex.Message);
                _messageBoxView.ShowError(_view, String.Format(CultureInfo.CurrentCulture,
                                                               "No client configurations were loaded from the given config file.{0}{0}{1}", Environment.NewLine, ex.Message), _view.Text);
            }
        }