private void WriteClientConfiguration(string fileName, int filterIndex) { try { var clients = ClientConfiguration.GetClients(); _settingsManager.Write(clients.Select(x => x.Settings), fileName, filterIndex); ClientConfiguration.IsDirty = false; ApplyClientIdentifierToBenchmarks(clients); } catch (Exception ex) { Logger.Error(ex.Message, ex); MessageBox.ShowError(Form, String.Format(CultureInfo.CurrentCulture, "The client configuration has not been saved.{0}{0}{1}", Environment.NewLine, ex.Message), Core.Application.NameAndVersion); } }
public void WriteTest() { var instance1 = new LegacyClient(); instance1.Settings = new ClientSettings(ClientType.Legacy) { Name = "test" }; const string testFile = "..\\..\\TestFiles\\new.ext"; var configurationManager = new ClientSettingsManager(GetPluginManager()); configurationManager.Write(new[] { instance1.Settings }, testFile, 1); Assert.AreEqual("..\\..\\TestFiles\\new.ext", configurationManager.FileName); Assert.AreEqual(1, configurationManager.FilterIndex); Assert.AreEqual(".ext", configurationManager.FileExtension); File.Delete(testFile); }