예제 #1
0
        public void DeleteFile()
        {
            using (var app = new VisualStudioApp())
            {
                var project = app.OpenProject(@"TestData\NodejsProjectData\DeleteFile.sln");

                using (new NodejsOptionHolder(NodejsPackage.Instance.GeneralOptionsPage, "ShowBrowserAndNodeLabels", false))
                {
                    var window = app.OpenSolutionExplorer();

                    // find server.js, send copy & paste, verify copy of file is there
                    var programPy = window.WaitForItem("Solution 'DeleteFile' (1 project)", "HelloWorld", "server.js");
                    Assert.IsTrue(File.Exists(@"TestData\NodejsProjectData\DeleteFile\server.js"));
                    AutomationWrapper.Select(programPy);

                    Keyboard.Type(Key.Delete);
                    app.WaitForDialog();
                    VisualStudioApp.CheckMessageBox(MessageBoxButton.Ok, "will be deleted permanently");
                    app.WaitForDialogDismissed();

                    window.WaitForItemRemoved("Solution 'DeleteFile' (1 project)", "HelloWorld", "server.js");

                    Assert.IsFalse(File.Exists(@"TestData\NodejsProjectData\DeleteFile\server.js"));
                }
            }
        }
예제 #2
0
        public void RemoveItem()
        {
            using (var app = new VisualStudioApp())
            {
                // close any projects before switching source control...
                app.Dte.Solution.Close();

                app.SelectSourceControlProvider("Test Source Provider");
                foreach (var projectType in ProjectTypes)
                {
                    var testDef = SourceControlProject(projectType);

                    using (var solution = testDef.Generate())
                    {
                        TestSccProvider.DocumentEvents.Clear();

                        var project  = app.OpenProject(solution.Filename);
                        var window   = app.OpenSolutionExplorer();
                        var fileName = "Program" + projectType.CodeExtension;
                        var program  = window.WaitForChildOfProject(project, fileName);

                        program.Select();

                        Keyboard.Type(Key.Delete);
                        app.WaitForDialog();
                        VisualStudioApp.CheckMessageBox(MessageBoxButton.Ok, "will be deleted permanently");
                        app.WaitForDialogDismissed();

                        window.WaitForChildOfProjectRemoved(project, fileName);

                        var projectDir = Path.GetDirectoryName(project.FullName);

                        AssertDocumentEvents(projectDir,
                                             OnQueryRemoveFiles(fileName),
                                             OnAfterRemoveFiles(fileName)
                                             );
                    }
                }
            }
        }
예제 #3
0
        public void DeferredSaveWithDot()
        {
            // http://pytools.codeplex.com/workitem/623
            // enable deferred saving on projects

            using (var app = new VisualStudioApp()) {
                var props     = app.Dte.get_Properties("Environment", "ProjectsAndSolution");
                var prevValue = props.Item("SaveNewProjects").Value;
                props.Item("SaveNewProjects").Value = false;
                app.OnDispose(() => props.Item("SaveNewProjects").Value = prevValue);

                // now run the test
                var newProjDialog = app.FileNewProject();

                newProjDialog.FocusLanguageNode("JavaScript");

                var consoleApp = newProjDialog.ProjectTypes.FindItem("Blank Node.js Application");
                consoleApp.Select();
                newProjDialog.ProjectName = "Fob.Baz";
                newProjDialog.ClickOK();

                // wait for new solution to load...
                for (int i = 0; i < 100 && app.Dte.Solution.Projects.Count == 0; i++)
                {
                    System.Threading.Thread.Sleep(1000);
                }

                TestUtils.DteExecuteCommandOnThreadPool("File.SaveAll");

                var saveProjDialog = new SaveProjectDialog(app.WaitForDialog());
                saveProjDialog.Save();

                app.WaitForDialogDismissed();

                var fullname = app.Dte.Solution.FullName;
                app.Dte.Solution.Close(false);

                Directory.Delete(Path.GetDirectoryName(fullname), true);
            }
        }
예제 #4
0
        public void DeferredSaveWithDot() {
            // http://pytools.codeplex.com/workitem/623
            // enable deferred saving on projects

            using (var app = new VisualStudioApp()) {
                var props = app.Dte.get_Properties("Environment", "ProjectsAndSolution");
                var prevValue = props.Item("SaveNewProjects").Value;
                props.Item("SaveNewProjects").Value = false;
                app.OnDispose(() => props.Item("SaveNewProjects").Value = prevValue);

                // now run the test
                var newProjDialog = app.FileNewProject();

                newProjDialog.FocusLanguageNode("JavaScript");

                var consoleApp = newProjDialog.ProjectTypes.FindItem("Blank Node.js Application");
                consoleApp.Select();
                newProjDialog.ProjectName = "Fob.Baz";
                newProjDialog.ClickOK();

                // wait for new solution to load...
                for (int i = 0; i < 100 && app.Dte.Solution.Projects.Count == 0; i++) {
                    System.Threading.Thread.Sleep(1000);
                }

                TestUtils.DteExecuteCommandOnThreadPool("File.SaveAll");

                var saveProjDialog = new SaveProjectDialog(app.WaitForDialog());
                saveProjDialog.Save();

                app.WaitForDialogDismissed();

                var fullname = app.Dte.Solution.FullName;
                app.Dte.Solution.Close(false);

                Directory.Delete(Path.GetDirectoryName(fullname), true);
            }
        }
예제 #5
0
        public void RemoveItem() {
            using (var app = new VisualStudioApp()) {

                // close any projects before switching source control...
                app.Dte.Solution.Close();

                app.SelectSourceControlProvider("Test Source Provider");
                foreach (var projectType in ProjectTypes) {
                    var testDef = SourceControlProject(projectType);

                    using (var solution = testDef.Generate()) {
                        TestSccProvider.DocumentEvents.Clear();

                        var project = app.OpenProject(solution.Filename, onDialog: OnNoSccDialog);
                        var window = app.SolutionExplorerTreeView;
                        var fileName = "Program" + projectType.CodeExtension;
                        var program = window.WaitForChildOfProject(project, fileName);

                        program.Select();

                        Keyboard.Type(Key.Delete);
                        app.WaitForDialog();
                        VisualStudioApp.CheckMessageBox(MessageBoxButton.Ok, "will be deleted permanently");
                        app.WaitForDialogDismissed();

                        window.WaitForChildOfProjectRemoved(project, fileName);

                        var projectDir = Path.GetDirectoryName(project.FullName);

                        AssertDocumentEvents(projectDir,
                            OnQueryRemoveFiles(fileName),
                            OnAfterRemoveFiles(fileName)
                        );
                    }
                }
            }
        }
예제 #6
0
        public void DeleteFile() {
            using (var app = new VisualStudioApp()) {
                var project = app.OpenProject(@"TestData\NodejsProjectData\DeleteFile.sln");

                using (new NodejsOptionHolder(NodejsPackage.Instance.GeneralOptionsPage, "ShowBrowserAndNodeLabels", false)) {
                    var window = app.OpenSolutionExplorer();

                    // find server.js, send copy & paste, verify copy of file is there
                    var programPy = window.WaitForItem("Solution 'DeleteFile' (1 project)", "HelloWorld", "server.js");
                    Assert.IsTrue(File.Exists(@"TestData\NodejsProjectData\DeleteFile\server.js"));
                    AutomationWrapper.Select(programPy);

                    Keyboard.Type(Key.Delete);
                    app.WaitForDialog();
                    VisualStudioApp.CheckMessageBox(MessageBoxButton.Ok, "will be deleted permanently");
                    app.WaitForDialogDismissed();

                    window.WaitForItemRemoved("Solution 'DeleteFile' (1 project)", "HelloWorld", "server.js");

                    Assert.IsFalse(File.Exists(@"TestData\NodejsProjectData\DeleteFile\server.js"));
                }
            }
        }