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


C# Matcher.Execute方法代码示例

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


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

示例1: MultipleSubDirsAfterFirstWildcardMatch_HasCorrectStem

        public void MultipleSubDirsAfterFirstWildcardMatch_HasCorrectStem()
        {
            var matcher = new Matcher();
            matcher.AddInclude("compiler/**/*.cs");

            var directoryPath = Path.Combine(_context.RootPath, "src/project");
            var results = matcher.Execute(new DirectoryInfoWrapper(new DirectoryInfo(directoryPath)));

            var actual = results.Files.Select(match => match.Stem);
            var expected = new string[] {
                "preprocess/preprocess-source1.cs",
                "preprocess/sub/preprocess-source2.cs",
                "preprocess/sub/sub/preprocess-source3.cs",
                "shared/shared1.cs",
                "shared/sub/shared2.cs",
                "shared/sub/sub/sharedsub.cs"
            };

            Assert.Equal(
                expected.OrderBy(e => e),
                actual.OrderBy(e => e),
                StringComparer.OrdinalIgnoreCase);
        }
开发者ID:leloulight,项目名称:FileSystem,代码行数:23,代码来源:FunctionalTests.cs

示例2: ExecuteAndVerify

        private void ExecuteAndVerify(Matcher matcher, string directoryPath, params string[] expectFiles)
        {
            directoryPath = Path.Combine(_context.RootPath, directoryPath);
            var results = matcher.Execute(new DirectoryInfoWrapper(new DirectoryInfo(directoryPath)));

            var actual = results.Files.Select(relativePath => Path.GetFullPath(Path.Combine(_context.RootPath, directoryPath, relativePath)));
            var expect = expectFiles.Select(relativePath => Path.GetFullPath(Path.Combine(_context.RootPath, relativePath)));

            AssertHelpers.SortAndEqual(expect, actual, StringComparer.OrdinalIgnoreCase);
        }
开发者ID:MetTeam,项目名称:FileSystem,代码行数:10,代码来源:FunctionalTests.cs

示例3: StemCorrectWithDifferentWildCards

        public void StemCorrectWithDifferentWildCards()
        {
            var matcher = new Matcher();
            matcher.AddInclude("sub/*.cs");
            matcher.AddInclude("**/*.cs");

            var directoryPath = Path.Combine(_context.RootPath, "src/project");
            var results = matcher.Execute(new DirectoryInfoWrapper(new DirectoryInfo(directoryPath)));

            var actual = results.Files.Select(match => match.Stem);
            var expected = new string[] {
                "source1.cs",
                "source2.cs",
                "source3.cs",
                "sub2/source4.cs",
                "sub2/source5.cs",
                "compiler/preprocess/preprocess-source1.cs",
                "compiler/preprocess/sub/preprocess-source2.cs",
                "compiler/preprocess/sub/sub/preprocess-source3.cs",
                "compiler/shared/shared1.cs",
                "compiler/shared/sub/shared2.cs",
                "compiler/shared/sub/sub/sharedsub.cs"
            };

            Assert.Equal(
                expected.OrderBy(e => e),
                actual.OrderBy(e => e),
                StringComparer.OrdinalIgnoreCase);
        }
开发者ID:leloulight,项目名称:FileSystem,代码行数:29,代码来源:FunctionalTests.cs


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