public void TestAddInsertConfig() { TestUtils.ClearSavedConfigurations(); TestUtils.InitializeInstallations(); var testConfigManager = new ConfigManager(new SkylineBatchLogger(TestUtils.GetTestFilePath("TestLog.log"))); Assert.IsTrue(!testConfigManager.HasConfigs()); var addedConfig = TestUtils.GetTestConfig("one"); testConfigManager.AddConfiguration(addedConfig); var oneConfig = TestUtils.ConfigListFromNames(new List <string> { "one" }); Assert.IsTrue(testConfigManager.ConfigListEquals(oneConfig)); testConfigManager.AddConfiguration(TestUtils.GetTestConfig("two")); testConfigManager.AddConfiguration(TestUtils.GetTestConfig("three")); var threeConfigs = TestUtils.ConfigListFromNames(new List <string> { "one", "two", "three" }); Assert.IsTrue(testConfigManager.ConfigListEquals(threeConfigs)); try { testConfigManager.AddConfiguration(addedConfig); Assert.Fail("Expected exception for duplicate configuration added."); } catch (ArgumentException e) { Assert.AreEqual(e.Message, "Failed operation \"Add\": Configuration \"one\" already exists."); } Assert.IsTrue(testConfigManager.ConfigListEquals(threeConfigs)); }
public static ConfigManager GetTestConfigManager() { var testConfigManager = new ConfigManager(new SkylineBatchLogger(GetTestFilePath("TestLog.log"))); while (testConfigManager.HasConfigs()) { testConfigManager.SelectConfig(0); testConfigManager.RemoveSelected(); } testConfigManager.AddConfiguration(GetTestConfig("one")); testConfigManager.AddConfiguration(GetTestConfig("two")); testConfigManager.AddConfiguration(GetTestConfig("three")); return(testConfigManager); }