-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: add new Pattern type that replaces IPatternMatcher<> making…
… the API a lot simpler.
- Loading branch information
Showing
16 changed files
with
314 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
34 changes: 0 additions & 34 deletions
34
src/MockHttp/Matchers/Patterns/RelativeOrAbsoluteUriPatternMatcher.cs
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace MockHttp.Patterns; | ||
|
||
internal interface IPattern | ||
{ | ||
string Value { get; } | ||
Func<string, bool> IsMatch { get; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
namespace MockHttp.Patterns; | ||
|
||
internal readonly record struct Pattern : IPattern | ||
{ | ||
public required string Value { get; internal init; } | ||
public required Func<string, bool> IsMatch { get; internal init; } | ||
|
||
/// <inheritdoc /> | ||
public override string ToString() | ||
{ | ||
return Value; | ||
} | ||
|
||
public static Pattern MatchExactly(string value) | ||
{ | ||
return new Pattern | ||
{ | ||
Value = value, | ||
IsMatch = input => StringComparer.Ordinal.Equals(value, input) | ||
}; | ||
} | ||
} |
Oops, something went wrong.