当前位置: 首页>>代码示例>>C#>>正文


C# PythonVisualStudioApp.WaitForOutputWindowText方法代码示例

本文整理汇总了C#中TestUtilities.UI.Python.PythonVisualStudioApp.WaitForOutputWindowText方法的典型用法代码示例。如果您正苦于以下问题:C# PythonVisualStudioApp.WaitForOutputWindowText方法的具体用法?C# PythonVisualStudioApp.WaitForOutputWindowText怎么用?C# PythonVisualStudioApp.WaitForOutputWindowText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TestUtilities.UI.Python.PythonVisualStudioApp的用法示例。


在下文中一共展示了PythonVisualStudioApp.WaitForOutputWindowText方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WebProjectStaticUri

        public void WebProjectStaticUri() {
            using (var app = new PythonVisualStudioApp()) {
                var project = app.CreateProject(
                    PythonVisualStudioApp.TemplateLanguageName,
                    PythonVisualStudioApp.EmptyWebProjectTemplate,
                    TestData.GetTempPath(),
                    "WebProjectStaticUri"
                );

                var proj = project.GetCommonProject();
                Assert.IsNotNull(proj);

                app.ServiceProvider.GetUIThread().Invoke(() => {
                    proj.SetProjectProperty("PythonWsgiHandler", "NoHandler");

                    proj.SetProjectProperty("StaticUriPattern", "");
                    proj.SetProjectProperty("StaticUriRewrite", "");
                });
                app.ExecuteCommand("Build.RebuildSolution");
                app.WaitForOutputWindowText("Build", "1 succeeded");

                var webConfig = File.ReadAllText(Path.Combine(Path.GetDirectoryName(project.FullName), "web.config"));
                if (!webConfig.Contains(@"<add input=""true"" pattern=""false"" />")) {
                    Assert.Fail(string.Format("Did not find Static Files condition in:{0}{0}{1}",
                        Environment.NewLine,
                        webConfig
                    ));
                }

                app.ServiceProvider.GetUIThread().Invoke(() => {
                    proj.SetProjectProperty("StaticUriPattern", "^static/.*$");
                });
                app.ExecuteCommand("Build.RebuildSolution");
                app.WaitForOutputWindowText("Build", "1 succeeded");

                webConfig = File.ReadAllText(Path.Combine(Path.GetDirectoryName(project.FullName), "web.config"));
                if (!webConfig.Contains(@"<add input=""{REQUEST_URI}"" pattern=""^static/.*$"" ignoreCase=""true"" negate=""true"" />")) {
                    Assert.Fail(string.Format("Did not find rewrite condition in:{0}{0}{1}",
                        Environment.NewLine,
                        webConfig
                    ));
                }
                if (!webConfig.Contains(@"<add input=""true"" pattern=""false"" />")) {
                    Assert.Fail(string.Format("Did not find Static Files condition in:{0}{0}{1}",
                        Environment.NewLine,
                        webConfig
                    ));
                }

                app.ServiceProvider.GetUIThread().Invoke(() => {
                    proj.SetProjectProperty("StaticUriRewrite", "static_files/{R:1}");
                });
                app.ExecuteCommand("Build.RebuildSolution");
                app.WaitForOutputWindowText("Build", "1 succeeded");

                webConfig = File.ReadAllText(Path.Combine(Path.GetDirectoryName(project.FullName), "web.config"));
                if (webConfig.Contains(@"<add input=""{REQUEST_URI}"" pattern=""^static/.*$"" ignoreCase=""true"" negate=""true"" />")) {
                    Assert.Fail(string.Format("Found old rewrite condition in:{0}{0}{1}",
                        Environment.NewLine,
                        webConfig
                    ));
                }
                if (!webConfig.Contains(@"<action type=""Rewrite"" url=""static_files/{R:1}"" appendQueryString=""true"" />")) {
                    Assert.Fail(string.Format("Did not find rewrite action in:{0}{0}{1}",
                        Environment.NewLine,
                        webConfig
                    ));
                }
                if (webConfig.Contains(@"<add input=""true"" pattern=""false"" />")) {
                    Assert.Fail(string.Format("Should not have found Static Files condition in:{0}{0}{1}",
                        Environment.NewLine,
                        webConfig
                    ));
                }

                app.ServiceProvider.GetUIThread().Invoke(() => {
                    proj.SetProjectProperty("StaticUriPattern", "invalid[pattern");
                });
                app.ExecuteCommand("Build.RebuildSolution");
                app.WaitForOutputWindowText("Build", "1 failed");
            }
        }
开发者ID:jsschultz,项目名称:PTVS,代码行数:82,代码来源:WebProjectTests.cs


注:本文中的TestUtilities.UI.Python.PythonVisualStudioApp.WaitForOutputWindowText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。