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


C# Microsoft.Build.Evaluation.GetPropertyValue方法代码示例

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


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

示例1: DiscoverTests

        private void DiscoverTests(Dictionary<string, List<TestFileEntry>> testItems, MSBuild.Project proj, ITestCaseDiscoverySink discoverySink, IMessageLogger logger) {
            List<TestFrameworks.NodejsTestInfo> result = new List<TestFrameworks.NodejsTestInfo>();
            var projectHome = Path.GetFullPath(Path.Combine(proj.DirectoryPath, "."));
            var projSource = ((MSBuild.Project)proj).FullPath;

            var nodeExePath =
                Nodejs.GetAbsoluteNodeExePath(
                    projectHome,
                    proj.GetPropertyValue(NodejsConstants.NodeExePath));

            if (!File.Exists(nodeExePath)) {
                logger.SendMessage(TestMessageLevel.Error, String.Format("Node.exe was not found.  Please install Node.js before running tests."));
                return;
            }

            int testCount = 0;
            foreach (string testFx in testItems.Keys) {
                TestFrameworks.TestFramework testFramework = GetTestFrameworkObject(testFx);
                if (testFramework == null) {
                    logger.SendMessage(TestMessageLevel.Warning, String.Format("Ignoring unsupported test framework {0}", testFx));
                    continue;
                }

                List<TestFileEntry> fileList = testItems[testFx];
                string files = string.Join(";", fileList.Select(p=>p.File));
                logger.SendMessage(TestMessageLevel.Informational, String.Format("Processing: {0}", files));

                List<TestFrameworks.NodejsTestInfo> discoveredTestCases = testFramework.FindTests(fileList.Select(p => p.File), nodeExePath, logger, projectHome);
                testCount += discoveredTestCases.Count;
                foreach (TestFrameworks.NodejsTestInfo discoveredTest in discoveredTestCases) {
                    string qualifiedName = discoveredTest.FullyQualifiedName;
                    logger.SendMessage(TestMessageLevel.Informational, String.Format("  " /*indent*/ + "Creating TestCase:{0}", qualifiedName));
                    //figure out the test source info such as line number
                    string filePath = discoveredTest.ModulePath;
                    TestFileEntry entry = fileList.Find(p => p.File.Equals(filePath, StringComparison.OrdinalIgnoreCase));
                    FunctionInformation fi = null;
                    if (entry.IsTypeScriptTest) {
                        fi = SourceMapper.MaybeMap(new FunctionInformation(String.Empty,
                                                                           discoveredTest.TestName,
                                                                           discoveredTest.SourceLine,
                                                                           entry.File));
                    }
                    discoverySink.SendTestCase(
                        new TestCase(qualifiedName, TestExecutor.ExecutorUri, projSource) {
                            CodeFilePath = (fi != null) ? fi.Filename : filePath,
                            LineNumber = (fi != null && fi.LineNumber.HasValue) ? fi.LineNumber.Value : discoveredTest.SourceLine,
                            DisplayName = discoveredTest.TestName
                        });

                }
                logger.SendMessage(TestMessageLevel.Informational, string.Format("Processing finished for framework of {0}", testFx));
            }
            if (testCount == 0) {
                logger.SendMessage(TestMessageLevel.Warning, String.Format("Discovered 0 testcases."));
            }
        }
开发者ID:munyirik,项目名称:nodejstools,代码行数:56,代码来源:TestDiscoverer.cs

示例2: GetTypeScriptBackedJavaScriptFile

 internal static string GetTypeScriptBackedJavaScriptFile(MSBuild.Project project, string pathToFile) {
     var typeScriptOutDir = project.GetPropertyValue(NodeProjectProperty.TypeScriptOutDir);
     return GetTypeScriptBackedJavaScriptFile(project.DirectoryPath, typeScriptOutDir, pathToFile);
 }
开发者ID:paladique,项目名称:nodejstools,代码行数:4,代码来源:TypeScriptHelpers.cs


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