public async Task LoadRunConfigurationFromProjectProperties() { string solFile = Util.GetSampleProject("run-configurations", "ConsoleProject", "ConsoleProject.default-console.csproj"); DotNetProject p = (DotNetProject)await Services.ProjectService.ReadSolutionItem(Util.GetMonitor(), solFile); Assert.AreEqual(1, p.RunConfigurations.Count); var es = p.RunConfigurations [0] as ProcessRunConfiguration; Assert.IsNotNull(es); Assert.IsTrue(es.ExternalConsole); var newConf = (ProcessRunConfiguration)p.CreateRunConfiguration("Extra"); newConf.StartArguments = "a"; p.RunConfigurations.Add(newConf); Assert.IsTrue(newConf.ExternalConsole); Assert.AreEqual("a", newConf.StartArguments); var newConf2 = (ProcessRunConfiguration)p.CreateRunConfiguration("Extra2"); newConf2.ExternalConsole = false; p.RunConfigurations.Add(newConf2); Assert.IsFalse(newConf2.ExternalConsole); p.Dispose(); }
public async Task SaveLoadedRunConfigurationFromProjectProperties() { string solFile = Util.GetSampleProject("run-configurations", "ConsoleProject", "ConsoleProject.default-console.csproj"); DotNetProject p = (DotNetProject)await Services.ProjectService.ReadSolutionItem(Util.GetMonitor(), solFile); Assert.AreEqual(1, p.RunConfigurations.Count); var es = p.RunConfigurations [0] as ProcessRunConfiguration; Assert.IsNotNull(es); Assert.IsTrue(es.ExternalConsole); var newConf = (ProcessRunConfiguration)p.CreateRunConfiguration("Extra"); p.RunConfigurations.Add(newConf); Assert.IsTrue(newConf.ExternalConsole); string projectXml = File.ReadAllText(p.FileName); await p.SaveAsync(Util.GetMonitor()); string newProjectXml = File.ReadAllText(p.FileName); Assert.AreEqual(newProjectXml, projectXml); Assert.IsTrue(File.Exists(p.FileName + ".user")); string projUserFile = Util.GetSampleProject("run-configurations", "ConsoleProject", "ConsoleProject.default-console-saved.csproj.user"); projectXml = File.ReadAllText(p.FileName + ".user"); newProjectXml = File.ReadAllText(projUserFile); Assert.AreEqual(newProjectXml, projectXml); p.Dispose(); }
public async Task SaveLoadedRunConfigurationFromProjectProperties2() { // Same as SaveLoadedRunConfigurationFromProjectProperties, but ExternalConsole is changed to False // In this case, even if ExternalConsole has the default value, it should be saved since its evaluated // value is True. // Also, an extra configuration should take the ExternalConsole value from the Default configuration string solFile = Util.GetSampleProject("run-configurations", "ConsoleProject", "ConsoleProject.default-console.csproj"); DotNetProject p = (DotNetProject)await Services.ProjectService.ReadSolutionItem(Util.GetMonitor(), solFile); Assert.AreEqual(1, p.RunConfigurations.Count); var es = p.RunConfigurations [0] as ProcessRunConfiguration; Assert.IsNotNull(es); Assert.IsTrue(es.ExternalConsole); es.ExternalConsole = false; var newConf = (ProcessRunConfiguration)p.CreateRunConfiguration("Extra"); p.RunConfigurations.Add(newConf); Assert.IsFalse(newConf.ExternalConsole); string projectXml = File.ReadAllText(p.FileName); await p.SaveAsync(Util.GetMonitor()); string newProjectXml = File.ReadAllText(p.FileName); Assert.AreEqual(newProjectXml, projectXml); Assert.IsTrue(File.Exists(p.FileName + ".user")); string projUserFile = Util.GetSampleProject("run-configurations", "ConsoleProject", "ConsoleProject.default-console-saved2.csproj.user"); projectXml = File.ReadAllText(p.FileName + ".user"); newProjectXml = File.ReadAllText(projUserFile); Assert.AreEqual(newProjectXml, projectXml); p.Dispose(); }