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")); }
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")); } } }