本文整理汇总了C#中Matcher类的典型用法代码示例。如果您正苦于以下问题:C# Matcher类的具体用法?C# Matcher怎么用?C# Matcher使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Matcher类属于命名空间,在下文中一共展示了Matcher类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: AssumptionViolatedException
public AssumptionViolatedException(object value, Matcher matcher)
{
base.\u002Ector(!(value is Exception) ? (Exception) null : (Exception) value);
AssumptionViolatedException violatedException = this;
this.fValue = value;
this.fMatcher = matcher;
}
开发者ID:NALSS,项目名称:SmartDashboard.NET,代码行数:7,代码来源:AssumptionViolatedException.cs
示例2: FolderExclude
public void FolderExclude()
{
var matcher = new Matcher();
matcher.AddInclude(@"**/*.*");
matcher.AddExclude(@"obj");
matcher.AddExclude(@"bin");
matcher.AddExclude(@".*");
ExecuteAndVerify(matcher, @"src/project",
"src/project/source1.cs",
"src/project/sub/source2.cs",
"src/project/sub/source3.cs",
"src/project/sub2/source4.cs",
"src/project/sub2/source5.cs",
"src/project/compiler/preprocess/preprocess-source1.cs",
"src/project/compiler/preprocess/sub/preprocess-source2.cs",
"src/project/compiler/preprocess/sub/sub/preprocess-source3.cs",
"src/project/compiler/preprocess/sub/sub/preprocess-source3.txt",
"src/project/compiler/shared/shared1.cs",
"src/project/compiler/shared/shared1.txt",
"src/project/compiler/shared/sub/shared2.cs",
"src/project/compiler/shared/sub/shared2.txt",
"src/project/compiler/shared/sub/sub/sharedsub.cs",
"src/project/compiler/resources/resource.res",
"src/project/compiler/resources/sub/resource2.res",
"src/project/compiler/resources/sub/sub/resource3.res",
"src/project/content1.txt");
}
开发者ID:sujiantao,项目名称:FileSystem,代码行数:28,代码来源:FunctionalTests.cs
示例3: That
public static void That(object actual, Matcher matcher)
{
if (!matcher.Match(actual))
{
throw new ExpectationException(matcher.FailureMessage);
}
}
开发者ID:ashmoran,项目名称:c-sharp-test-framework,代码行数:7,代码来源:Expect.cs
示例4: IncludeCaseInsensitive
public void IncludeCaseInsensitive(string root, string includePattern, string[] expectedFiles)
{
var matcher = new Matcher(StringComparison.OrdinalIgnoreCase);
matcher.AddInclude(includePattern);
ExecuteAndVerify(matcher, root, expectedFiles.Select(f => root + "/" + f).ToArray());
}
开发者ID:leloulight,项目名称:FileSystem,代码行数:7,代码来源:FunctionalTests.cs
示例5: RegexCaseMatch
public void RegexCaseMatch()
{
var match = new Matcher<string, string>
{
{ Case.Rx(new Regex("\\d{3}")), s => "Success" }
}.ToFunc();
Assert.Equal("Success", match("123"));
}
开发者ID:danslapman,项目名称:PatternMatching,代码行数:9,代码来源:MatcherTests.cs
示例6: assumeThat
public static void assumeThat(object actual, Matcher matcher)
{
if (matcher.matches(actual))
return;
object obj = actual;
Matcher matcher1 = matcher;
Throwable.__\u003CsuppressFillInStackTrace\u003E();
throw new AssumptionViolatedException(obj, matcher1);
}
开发者ID:NALSS,项目名称:SmartDashboard.NET,代码行数:9,代码来源:Assume.cs
示例7: EmptyCollectionWhenNoFilesPresent
public void EmptyCollectionWhenNoFilesPresent()
{
var matcher = new Matcher();
var scenario = new FileSystemGlobbingTestContext(@"c:\files\", matcher)
.Include("alpha.txt")
.Execute();
scenario.AssertExact();
}
开发者ID:sujiantao,项目名称:FileSystem,代码行数:9,代码来源:PatternMatchingTests.cs
示例8: DuplicatePatterns
public void DuplicatePatterns(string pattern1, string pattern2)
{
var matcher = new Matcher();
matcher.AddInclude(pattern1);
matcher.AddInclude(pattern2);
ExecuteAndVerify(matcher, @"src/project",
"src/project/sub/source2.cs");
}
开发者ID:MetTeam,项目名称:FileSystem,代码行数:9,代码来源:FunctionalTests.cs
示例9: RegexWithGroupMatchTest
public void RegexWithGroupMatchTest()
{
var match = new Matcher<string, string>
{
{ Case.Rx(new Regex("this\\s(\\d{3})")), s => s }
}.ToFunc();
Assert.Equal("123", match("this 123"));
}
开发者ID:danslapman,项目名称:PatternMatching,代码行数:9,代码来源:MatcherTests.cs
示例10: DoubleParentsWithRecursiveSearch
public void DoubleParentsWithRecursiveSearch()
{
var matcher = new Matcher();
matcher.AddInclude(@"..\..\lib\**\*.cs");
ExecuteAndVerify(matcher, @"src/project",
"lib/source6.cs",
"lib/sub3/source7.cs",
"lib/sub4/source8.cs");
}
开发者ID:MetTeam,项目名称:FileSystem,代码行数:10,代码来源:FunctionalTests.cs
示例11: BuildableExpectation
/// <summary>
/// Initializes a new instance of the <see cref="BuildableExpectation"/> class.
/// </summary>
/// <param name="expectationDescription">The expectation description.</param>
/// <param name="requiredCountMatcher">The required count matcher.</param>
/// <param name="matchingCountMatcher">The matching count matcher.</param>
public BuildableExpectation(string expectationDescription, Matcher requiredCountMatcher, Matcher matchingCountMatcher)
{
_expectationDescription = expectationDescription;
_requiredCountMatcher = requiredCountMatcher;
_matchingCountMatcher = matchingCountMatcher;
ArgumentsMatcher = new ArgumentsMatcher();
IsValid = false;
}
开发者ID:textmetal,项目名称:main,代码行数:16,代码来源:BuildableExpectation.cs
示例12: SlashPolarityIsIgnored
public void SlashPolarityIsIgnored(string includePattern, string filePath)
{
var matcher = new Matcher();
var scenario = new FileSystemGlobbingTestContext(@"c:\files\", matcher)
.Include(includePattern)
.Files("one/two.txt", filePath, "three/four.txt")
.Execute();
scenario.AssertExact("beta/alpha.txt");
}
开发者ID:leloulight,项目名称:FileSystem,代码行数:10,代码来源:PatternMatchingTests.cs
示例13: MismatchedFileIsIgnored
public void MismatchedFileIsIgnored()
{
var matcher = new Matcher();
var scenario = new FileSystemGlobbingTestContext(@"c:\files\", matcher)
.Include("alpha.txt")
.Files("omega.txt")
.Execute();
scenario.AssertExact();
}
开发者ID:leloulight,项目名称:FileSystem,代码行数:10,代码来源:PatternMatchingTests.cs
示例14: PatternMatchingWorks
public void PatternMatchingWorks(string includePattern, string[] matchesExpected)
{
var matcher = new Matcher();
var scenario = new FileSystemGlobbingTestContext(@"c:\files\", matcher)
.Include(includePattern)
.Files("alpha.txt", "beta.txt", "gamma.dat")
.Execute();
scenario.AssertExact(matchesExpected);
}
开发者ID:leloulight,项目名称:FileSystem,代码行数:10,代码来源:PatternMatchingTests.cs
示例15: FolderNamesAreTraversed
public void FolderNamesAreTraversed()
{
var matcher = new Matcher();
var scenario = new FileSystemGlobbingTestContext(@"c:\files\", matcher)
.Include("beta/alpha.txt")
.Files("beta/alpha.txt")
.Execute();
scenario.AssertExact("beta/alpha.txt");
}
开发者ID:leloulight,项目名称:FileSystem,代码行数:10,代码来源:PatternMatchingTests.cs
示例16: StringMatching
public void StringMatching()
{
var match = new Matcher<string, int>
{
{s => string.IsNullOrEmpty(s), (string _) => 0},
{s => true, s => s.Length}
}.ToFunc();
Assert.Equal(0, match(null));
Assert.Equal(4, match("test"));
}
开发者ID:danslapman,项目名称:PatternMatching,代码行数:11,代码来源:MatcherTests.cs
示例17: ExcludeMayEndInDirectoryName
public void ExcludeMayEndInDirectoryName()
{
var matcher = new Matcher();
var scenario = new FileSystemGlobbingTestContext(@"c:\files\", matcher)
.Include("*.cs", "*/*.cs", "*/*/*.cs")
.Exclude("bin", "one/two")
.Files("one/x.cs", "two/x.cs", "one/two/x.cs", "x.cs", "bin/x.cs", "bin/two/x.cs")
.Execute();
scenario.AssertExact("one/x.cs", "two/x.cs", "x.cs");
}
开发者ID:sujiantao,项目名称:FileSystem,代码行数:11,代码来源:PatternMatchingTests.cs
示例18: ExcludeCanHaveSurroundingRecursiveWildcards
public void ExcludeCanHaveSurroundingRecursiveWildcards()
{
var matcher = new Matcher();
var scenario = new FileSystemGlobbingTestContext(@"c:\files\", matcher)
.Include("**")
.Exclude("**/x/**")
.Files("x/1", "1/x/2", "1/x", "x", "1", "1/2")
.Execute();
scenario.AssertExact("1/x", "x", "1", "1/2");
}
开发者ID:sujiantao,项目名称:FileSystem,代码行数:11,代码来源:PatternMatchingTests.cs
示例19: Main
static void Main(string[] args)
{
var match = new Matcher<string, string>
{
{ Case.Rx(new Regex("test\\s(\\d{3})")), a => a },
{ _ => true, (string _) => "nope" }
}.ToFunc();
Console.WriteLine(match("test 333"));
Console.ReadKey();
}
开发者ID:danslapman,项目名称:PatternMatching,代码行数:11,代码来源:Program.cs
示例20: or
public virtual CombinableMatcher or(Matcher matcher)
{
Matcher[] matcherArray = new Matcher[2];
int index1 = 0;
Matcher matcher1 = matcher;
matcherArray[index1] = matcher1;
int index2 = 1;
Matcher matcher2 = this.fMatcher;
matcherArray[index2] = matcher2;
return new CombinableMatcher(CoreMatchers.anyOf(matcherArray));
}
开发者ID:NALSS,项目名称:SmartDashboard.NET,代码行数:11,代码来源:CombinableMatcher.cs
注:本文中的Matcher类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论