Beispiel #1
0
        public void StartNewAppDuplicateName()
        {
            using (var app = new VisualStudioApp()) {
                var project = app.CreateProject(
                    PythonVisualStudioApp.TemplateLanguageName,
                    PythonVisualStudioApp.DjangoWebProjectTemplate,
                    TestData.GetTempPath(),
                    "StartNewAppDuplicateName"
                    );
                app.SolutionExplorerTreeView.SelectProject(project);

                using (var newAppDialog = NewAppDialog.FromDte(app)) {
                    newAppDialog.AppName = "Fob";
                    newAppDialog.OK();
                }

                app.SolutionExplorerTreeView.WaitForItem(
                    app.Dte.Solution.FullName,
                    app.Dte.Solution.Projects.Item(1).Name,
                    "Fob",
                    "models.py"
                    );

                app.Dte.Documents.CloseAll(EnvDTE.vsSaveChanges.vsSaveChangesNo);

                app.SolutionExplorerTreeView.SelectProject(project);
                using (var newAppDialog = NewAppDialog.FromDte(app)) {
                    newAppDialog.AppName = "Fob";
                    newAppDialog.OK();
                }

                using (var dlg = AutomationDialog.WaitForDialog(app)) { }
            }
        }
Beispiel #2
0
        public void DragDropTest()
        {
            using (var app = new VisualStudioApp()) {
                app.OpenProject(@"TestData\DragDropRelocatedTest.sln");

                app.OpenSolutionExplorer();
                var window = app.SolutionExplorerTreeView;

                var folder = window.FindItem("Solution 'DragDropRelocatedTest' (1 project)", "DragDropTest", "TestFolder", "SubItem.py");
                var point  = folder.GetClickablePoint();
                Mouse.MoveTo(point);
                Mouse.Down(MouseButton.Left);

                var projectItem = window.FindItem("Solution 'DragDropRelocatedTest' (1 project)", "DragDropTest");
                point = projectItem.GetClickablePoint();
                Mouse.MoveTo(point);
                Mouse.Up(MouseButton.Left);

                using (var dlg = AutomationDialog.WaitForDialog(app)) {
                    dlg.OK();
                }
                Assert.IsNotNull(window.WaitForItem("Solution 'DragDropRelocatedTest' (1 project)", "DragDropTest", "SubItem.py"));

                app.Dte.Solution.Close(true);
                // Ensure file was moved and the path was updated correctly.
                var project = app.OpenProject(@"TestData\DragDropRelocatedTest.sln");
                foreach (var item in project.ProjectItems.OfType <OAFileItem>())
                {
                    Assert.IsTrue(File.Exists((string)item.Properties.Item("FullPath").Value), (string)item.Properties.Item("FullPath").Value);
                }
            }
        }
Beispiel #3
0
        public void DragDropFileToContainingFolderTest(PythonVisualStudioApp app)
        {
            var project = app.OpenProject(@"TestData\DragDropTest.sln");
            var window  = app.OpenSolutionExplorer();

            Mouse.MoveTo(window.FindChildOfProject(project, "TestFolder", "SubItem2.py").Element.GetClickablePoint());
            Mouse.Down(MouseButton.Left);

            Mouse.MoveTo(window.FindChildOfProject(project, "TestFolder").Element.GetClickablePoint());
            Mouse.Up(MouseButton.Left);

            using (var dlg = AutomationDialog.WaitForDialog(app)) { }
            window.WaitForChildOfProject(project, "TestFolder", "SubItem2.py");
        }
Beispiel #4
0
        public void StartNewAppSameAsProjectName(VisualStudioApp app, DjangoInterpreterSetter interpreterSetter)
        {
            var project = app.CreateProject(
                PythonVisualStudioApp.TemplateLanguageName,
                PythonVisualStudioApp.DjangoWebProjectTemplate,
                TestData.GetTempPath(),
                "StartNewAppSameAsProjectName"
                );

            app.SolutionExplorerTreeView.SelectProject(project);

            using (var newAppDialog = NewAppDialog.FromDte(app)) {
                newAppDialog.AppName = app.Dte.Solution.Projects.Item(1).Name;
                newAppDialog.OK();
            }

            using (var dlg = AutomationDialog.WaitForDialog(app)) { }
        }
        /// <summary>
        /// Move item to where item exists across project types.
        /// </summary>
        private void MoveDuplicateFileNameCrossProjectCSharpSkipMove(VisualStudioApp app, ProjectGenerator pg, MoveDelegate mover)
        {
            foreach (var projectType in pg.ProjectTypes)
            {
                var projectDefs = new[] {
                    new ProjectDefinition("MoveDuplicateFileName1",
                                          projectType,
                                          ProjectGenerator.ItemGroup(
                                              ProjectGenerator.Content("textfile.txt", "MoveDuplicateFileName1")
                                              )
                                          ),
                    new ProjectDefinition("MoveDuplicateFileNameCS",
                                          ProjectType.CSharp,
                                          ProjectGenerator.ItemGroup(
                                              ProjectGenerator.Folder("Folder"),
                                              ProjectGenerator.Content("textfile.txt", "MoveDuplicateFileNameCS")
                                              )
                                          )
                };

                using (var solution = SolutionFile.Generate("MoveDuplicateFileName", projectDefs).ToVs(app)) {
                    mover(
                        solution,
                        solution.FindItem("MoveDuplicateFileNameCS"),
                        solution.FindItem("MoveDuplicateFileName1", "textfile.txt")
                        );

                    // say no to replacing in the C# project system
                    using (var dlg = AutomationDialog.WaitForDialog(app)) {
                        dlg.ClickButtonAndClose("No");
                    }

                    solution.AssertFileExistsWithContent("MoveDuplicateFileName1", "MoveDuplicateFileName1", "textfile.txt");
                    solution.AssertFileExistsWithContent("MoveDuplicateFileNameCS", "MoveDuplicateFileNameCS", "textfile.txt");
                }
            }
        }