예제 #1
0
파일: UITests.cs 프로젝트: rsumner33/PTVS
        public void SaveAs()
        {
            var project = DebugProject.OpenProject(@"Python.VS.TestData\SaveAsUI.sln");
            var app     = new VisualStudioApp(VsIdeTestHostContext.Dte);

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

            // open and edit the file
            var folderNode = solutionTree.FindItem("Solution 'SaveAsUI' (1 project)", "HelloWorld", "Program.py");

            folderNode.SetFocus();
            Keyboard.PressAndRelease(Key.Enter);

            var item   = project.ProjectItems.Item("Program.py");
            var window = item.Open();

            var selection = ((TextSelection)window.Selection);

            selection.SelectAll();
            selection.Delete();

            // save under a new file name
            var    saveDialog = app.SaveAs();
            string oldName    = saveDialog.FileName;

            saveDialog.FileName = "Program2.py";
            saveDialog.Save();

            Assert.AreNotEqual(null, solutionTree.WaitForItem("Solution 'SaveAsUI' (1 project)", "HelloWorld", "Program2.py"));
        }
예제 #2
0
        public void SaveAs()
        {
            using (var app = new VisualStudioApp())
            {
                var project = app.OpenProject(@"TestData\NodejsProjectData\SaveAsUI.sln");

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

                    // open and edit the file
                    var folderNode = solutionTree.WaitForItem("Solution 'SaveAsUI' (1 project)", "HelloWorld", "server.js");
                    folderNode.SetFocus();
                    Keyboard.PressAndRelease(Key.Enter);

                    var item   = project.ProjectItems.Item("server.js");
                    var window = item.Open();
                    window.Activate();

                    var selection = ((TextSelection)window.Selection);
                    selection.SelectAll();
                    selection.Delete();

                    // save under a new file name
                    var    saveDialog = app.SaveAs();
                    string oldName    = saveDialog.FileName;
                    saveDialog.FileName = "Program2.js";
                    saveDialog.Save();

                    Assert.AreNotEqual(null, solutionTree.WaitForItem("Solution 'SaveAsUI' (1 project)", "HelloWorld", "Program2.js"));
                }
            }
        }
예제 #3
0
        public void SaveAs() {
            using (var app = new VisualStudioApp()) {
                var project = app.OpenProject(@"TestData\NodejsProjectData\SaveAsUI.sln");

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

                    // open and edit the file
                    var folderNode = solutionTree.WaitForItem("Solution 'SaveAsUI' (1 project)", "HelloWorld", "server.js");
                    folderNode.SetFocus();
                    Keyboard.PressAndRelease(Key.Enter);

                    var item = project.ProjectItems.Item("server.js");
                    var window = item.Open();
                    window.Activate();

                    var selection = ((TextSelection)window.Selection);
                    selection.SelectAll();
                    selection.Delete();

                    // save under a new file name
                    var saveDialog = app.SaveAs();
                    string oldName = saveDialog.FileName;
                    saveDialog.FileName = "Program2.js";
                    saveDialog.Save();

                    Assert.AreNotEqual(null, solutionTree.WaitForItem("Solution 'SaveAsUI' (1 project)", "HelloWorld", "Program2.js"));
                }
            }
        }