public void NewProject() { using (var app = new PythonVisualStudioApp()) { using (var newProjDialog = NewProjectDialog.FromDte(app)) { newProjDialog.FocusLanguageNode(); var consoleApp = newProjDialog.ProjectTypes.FindItem("Python Application"); consoleApp.Select(); newProjDialog.OK(); } // wait for new solution to load... for (int i = 0; i < 10 && app.Dte.Solution.Projects.Count == 0; i++) { System.Threading.Thread.Sleep(1000); } Assert.AreEqual(1, app.Dte.Solution.Projects.Count); var project = app.Dte.Solution.Projects.Item(1); Console.WriteLine("Project.Name: {0}", project.Name ?? "(null)"); var itemName = Path.ChangeExtension(project.Name, ".py"); Console.WriteLine("Expected item: {0}", itemName); Console.WriteLine("Items:"); foreach (var item in project.ProjectItems.OfType <ProjectItem>()) { Console.WriteLine(" {0}", item.Name ?? "(null)"); } Assert.IsNotNull(project.ProjectItems.Item(itemName)); } }
public void NewProject() { using (var app = new PythonVisualStudioApp()) { using (var newProjDialog = NewProjectDialog.FromDte(app)) { newProjDialog.FocusLanguageNode(); var consoleApp = newProjDialog.ProjectTypes.FindItem("Python Application"); consoleApp.Select(); newProjDialog.OK(); } // wait for new solution to load... for (int i = 0; i < 10 && app.Dte.Solution.Projects.Count == 0; i++) { System.Threading.Thread.Sleep(1000); } Assert.AreEqual(1, app.Dte.Solution.Projects.Count); Assert.IsNotNull(app.Dte.Solution.Projects.Item(1).ProjectItems.Item(Path.GetFileNameWithoutExtension(app.Dte.Solution.FullName) + ".py")); } }