Esempio n. 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)) { }
            }
        }
Esempio n. 2
0
        public void StartNewApp(PythonVisualStudioApp app, DjangoInterpreterSetter interpreterSetter)
        {
            var project = app.CreateProject(
                PythonVisualStudioApp.TemplateLanguageName,
                PythonVisualStudioApp.DjangoWebProjectTemplate,
                TestData.GetTempPath(),
                "StartNewApp"
                );

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

            var appFolder = project.ProjectItems.Item("Fob");

            Assert.IsNotNull(appFolder.ProjectItems.Item("models.py"));
            Assert.IsNotNull(appFolder.ProjectItems.Item("tests.py"));
            Assert.IsNotNull(appFolder.ProjectItems.Item("views.py"));
            Assert.IsNotNull(appFolder.ProjectItems.Item("__init__.py"));

            var templatesFolder    = appFolder.ProjectItems.Item("templates");
            var templatesAppFolder = templatesFolder.ProjectItems.Item("Fob");

            Assert.IsNotNull(templatesAppFolder.ProjectItems.Item("index.html"));

            app.SolutionExplorerTreeView.SelectProject(project);
            app.Dte.ExecuteCommand("Project.DjangoCheckDjango17");

            using (var console = app.GetInteractiveWindow("Django Management Console - " + project.Name)) {
                Assert.IsNotNull(console);
                console.WaitForTextEnd("The interactive Python process has exited.", ">");

                var consoleText = console.TextView.TextSnapshot.GetText();
                AssertUtil.Contains(consoleText, "Executing manage.py check");
                AssertUtil.Contains(consoleText, "System check identified no issues (0 silenced).");
            }

            app.SolutionExplorerTreeView.SelectProject(project);

            using (var newItem = NewItemDialog.FromDte(app)) {
                var htmlPage = newItem.ProjectTypes.FindItem("HTML Page");
                htmlPage.Select();
                newItem.FileName = "NewPage.html";
                newItem.OK();
            }

            System.Threading.Thread.Sleep(1000);

            Assert.IsNotNull(project.ProjectItems.Item("NewPage.html"));
        }
Esempio n. 3
0
        public void StartNewApp()
        {
            using (var app = new PythonVisualStudioApp()) {
                var project = app.CreateProject(
                    PythonVisualStudioApp.TemplateLanguageName,
                    PythonVisualStudioApp.DjangoWebProjectTemplate,
                    TestData.GetTempPath(),
                    "StartNewApp"
                    );
                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"
                    );

                var appFolder = project.ProjectItems.Item("Fob");
                Assert.IsNotNull(appFolder.Collection.Item("models.py"));
                Assert.IsNotNull(appFolder.Collection.Item("tests.py"));
                Assert.IsNotNull(appFolder.Collection.Item("views.py"));
                Assert.IsNotNull(appFolder.Collection.Item("__init__.py"));

                app.SolutionExplorerTreeView.SelectProject(project);
                app.Dte.ExecuteCommand("Project.ValidateDjangoApp");

                using (var console = app.GetInteractiveWindow("Django Management Console - " + project.Name)) {
                    Assert.IsNotNull(console);
                    console.WaitForTextEnd(
                        "Executing manage.py validate",
                        "0 errors found",
                        "The Python REPL process has exited",
                        ">"
                        );
                }

                app.SolutionExplorerTreeView.SelectProject(project);

                using (var newItem = NewItemDialog.FromDte(app)) {
                    AutomationWrapper.Select(newItem.ProjectTypes.FindItem("HTML Page"));
                    newItem.FileName = "NewPage.html";
                    newItem.OK();
                }

                System.Threading.Thread.Sleep(1000);

                Assert.IsNotNull(project.ProjectItems.Item("NewPage.html"));
            }
        }
Esempio n. 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)) { }
        }