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


C# ProjectDefinition.ToMockVs方法代码示例

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


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

示例1: BasicProjectTest

        public void BasicProjectTest() {
            var sln = new ProjectDefinition(
                "HelloWorld",
                PythonProject,
                Compile("server", "")
            ).Generate();

            using (var vs = sln.ToMockVs()) {
                Assert.IsNotNull(vs.WaitForItem("HelloWorld", "Python Environments"));
                Assert.IsNotNull(vs.WaitForItem("HelloWorld", "References"));
                Assert.IsNotNull(vs.WaitForItem("HelloWorld", "Search Paths"));
                Assert.IsNotNull(vs.WaitForItem("HelloWorld", "server.py"));
                var view = vs.OpenItem("HelloWorld", "server.py");

                view.Invoke(() => view.Type("import "));

                using (var sh = view.WaitForSession<ICompletionSession>()) {
                    AssertUtil.Contains(sh.Session.Completions(), "sys");
                }
            }
        }
开发者ID:jsschultz,项目名称:PTVS,代码行数:21,代码来源:ProjectTests.cs

示例2: ShouldWarnOnRun

        public void ShouldWarnOnRun() {
            var sln = new ProjectDefinition(
                "HelloWorld",
                PythonProject,
                Compile("app", "print \"hello\"")
            ).Generate();

            using (var vs = sln.ToMockVs())
            using (var analyzerChanged = new AutoResetEvent(false)) {
                var project = vs.GetProject("HelloWorld").GetPythonProject();
                project.ProjectAnalyzerChanged += (s, e) => analyzerChanged.Set();

                var uiThread = (UIThreadBase)project.GetService(typeof(UIThreadBase));
                var interpreters = ((IComponentModel)project.GetService(typeof(SComponentModel)))
                    .GetService<IInterpreterRegistryService>()
                    .Interpreters;
                
                var v27 = interpreters.Where(x => x.Configuration.Id == "Global|PythonCore|2.7|x86").First();
                var v34 = interpreters.Where(x => x.Configuration.Id == "Global|PythonCore|3.4|x86").First();
                var interpOptions = (UIThreadBase)project.GetService(typeof(IComponentModel));

                uiThread.Invoke(() => {
                    project.AddInterpreter(v27.Configuration.Id);
                    project.AddInterpreter(v34.Configuration.Id);
                });

                project.SetInterpreterFactory(v27);
                Assert.IsTrue(analyzerChanged.WaitOne(10000), "Timed out waiting for analyzer change #1");
                uiThread.Invoke(() => project.GetAnalyzer()).WaitForCompleteAnalysis(_ => true);
                Assert.IsFalse(project.ShouldWarnOnLaunch, "Should not warn on 2.7");

                project.SetInterpreterFactory(v34);
                Assert.IsTrue(analyzerChanged.WaitOne(10000), "Timed out waiting for analyzer change #2");
                uiThread.Invoke(() => project.GetAnalyzer()).WaitForCompleteAnalysis(_ => true);
                Assert.IsTrue(project.ShouldWarnOnLaunch, "Expected warning on 3.4");

                project.SetInterpreterFactory(v27);
                Assert.IsTrue(analyzerChanged.WaitOne(10000), "Timed out waiting for analyzer change #3");
                uiThread.Invoke(() => project.GetAnalyzer()).WaitForCompleteAnalysis(_ => true);
                Assert.IsFalse(project.ShouldWarnOnLaunch, "Expected warning to go away on 2.7");
            }
        }
开发者ID:jsschultz,项目名称:PTVS,代码行数:42,代码来源:ProjectTests.cs

示例3: ShouldWarnOnRun

        public void ShouldWarnOnRun() {
            var sln = new ProjectDefinition(
                "HelloWorld",
                PythonProject,
                Compile("app", "print \"hello\"")
            ).Generate();

            using (var vs = sln.ToMockVs())
            using (var analyzerChanged = new AutoResetEvent(false)) {
                var project = vs.GetProject("HelloWorld").GetPythonProject();
                project.ProjectAnalyzerChanged += (s, e) => analyzerChanged.Set();

                var v27 = InterpreterFactoryCreator.CreateInterpreterFactory(new InterpreterFactoryCreationOptions {
                    LanguageVersion = new Version(2, 7),
                    PrefixPath = "C:\\Python27",
                    InterpreterPath = "C:\\Python27\\python.exe"
                });
                var v34 = InterpreterFactoryCreator.CreateInterpreterFactory(new InterpreterFactoryCreationOptions {
                    LanguageVersion = new Version(3, 4),
                    PrefixPath = "C:\\Python34",
                    InterpreterPath = "C:\\Python34\\python.exe"
                });

                var uiThread = (UIThreadBase)project.GetService(typeof(UIThreadBase));

                uiThread.Invoke(() => {
                    project.Interpreters.AddInterpreter(v27);
                    project.Interpreters.AddInterpreter(v34);
                });

                project.SetInterpreterFactory(v27);
                Assert.IsTrue(analyzerChanged.WaitOne(10000), "Timed out waiting for analyzer change #1");
                uiThread.Invoke(() => project.GetAnalyzer()).WaitForCompleteAnalysis(_ => true);
                Assert.IsFalse(project.ShouldWarnOnLaunch, "Should not warn on 2.7");

                project.SetInterpreterFactory(v34);
                Assert.IsTrue(analyzerChanged.WaitOne(10000), "Timed out waiting for analyzer change #2");
                uiThread.Invoke(() => project.GetAnalyzer()).WaitForCompleteAnalysis(_ => true);
                Assert.IsTrue(project.ShouldWarnOnLaunch, "Expected warning on 3.4");

                project.SetInterpreterFactory(v27);
                Assert.IsTrue(analyzerChanged.WaitOne(10000), "Timed out waiting for analyzer change #3");
                uiThread.Invoke(() => project.GetAnalyzer()).WaitForCompleteAnalysis(_ => true);
                Assert.IsFalse(project.ShouldWarnOnLaunch, "Expected warning to go away on 2.7");
            }
        }
开发者ID:omnimark,项目名称:PTVS,代码行数:46,代码来源:ProjectTests.cs


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