本文整理汇总了C#中Matcher类的典型用法代码示例。如果您正苦于以下问题:C# Matcher类的具体用法?C# Matcher怎么用?C# Matcher使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Matcher类属于命名空间,在下文中一共展示了Matcher类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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");
}
示例3: That
public static void That(object actual, Matcher matcher)
{
if (!matcher.Match(actual))
{
throw new ExpectationException(matcher.FailureMessage);
}
}
示例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());
}
示例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"));
}
示例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);
}
示例7: EmptyCollectionWhenNoFilesPresent
public void EmptyCollectionWhenNoFilesPresent()
{
var matcher = new Matcher();
var scenario = new FileSystemGlobbingTestContext(@"c:\files\", matcher)
.Include("alpha.txt")
.Execute();
scenario.AssertExact();
}
示例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");
}
示例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"));
}
示例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");
}
示例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;
}
示例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");
}
示例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();
}
示例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);
}
示例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");
}