コード例 #1
0
ファイル: UITests.cs プロジェクト: zhangjinxing/PTVS
        public void TransferItem()
        {
            using (var app = new PythonVisualStudioApp()) {
                var project = app.OpenProject(@"TestData\HelloWorld.sln");

                string filename, basename;
                int    i = 0;
                do
                {
                    i++;
                    basename = "test" + i + " .py";
                    filename = Path.Combine(TestData.GetTempPath(), basename);
                } while (System.IO.File.Exists(filename));

                System.IO.File.WriteAllText(filename, "def f(): pass");

                var fileWindow = app.Dte.ItemOperations.OpenFile(filename);

                using (var dialog = ChooseLocationDialog.FromDte(app)) {
                    dialog.SelectProject("HelloWorld");
                    dialog.OK();
                }

                app.OpenSolutionExplorer().WaitForChildOfProject(project, basename);

                Assert.AreEqual(basename, fileWindow.Caption);

                System.IO.File.Delete(filename);
            }
        }
コード例 #2
0
ファイル: UITests.cs プロジェクト: ccwalkerjm/nodejstools
        public void TransferItem()
        {
            using (var app = new VisualStudioApp()) {
                var project = app.OpenProject(@"TestData\NodejsProjectData\HelloWorld.sln");

                using (new NodejsOptionHolder(NodejsPackage.Instance.GeneralOptionsPage, "ShowBrowserAndNodeLabels", false)) {
                    string filename, basename;
                    int    i = 0;
                    do
                    {
                        i++;
                        basename = "test" + i + " .js";
                        filename = Path.Combine(Path.GetTempPath(), basename);
                    } while (System.IO.File.Exists(filename));

                    System.IO.File.WriteAllText(filename, "function f() { }");

                    var fileWindow = app.Dte.ItemOperations.OpenFile(filename);

                    using (var dlg = ChooseLocationDialog.FromDte(app)) {
                        dlg.SelectProject("HelloWorld");
                        dlg.OK();
                    }

                    var window = app.OpenSolutionExplorer();
                    Assert.AreNotEqual(null, window.WaitForItem("Solution 'HelloWorld' (1 project)", "HelloWorld", basename));

                    Assert.AreEqual(fileWindow.Caption, basename);

                    System.IO.File.Delete(filename);
                }
            }
        }