Skip to content

Commit e6ff877

Browse files
authored
Make CSharpCodeMatcher public (#1337)
1 parent c32e904 commit e6ff877

File tree

2 files changed

+16
-22
lines changed

2 files changed

+16
-22
lines changed

src/WireMock.Net.Matchers.CSharpCode/Matchers/CSharpCodeMatcher.cs

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace WireMock.Matchers;
1818
/// CSharpCode / CS-Script Matcher
1919
/// </summary>
2020
/// <inheritdoc cref="ICSharpCodeMatcher"/>
21-
internal class CSharpCodeMatcher : ICSharpCodeMatcher
21+
public class CSharpCodeMatcher : ICSharpCodeMatcher
2222
{
2323
private const string TemplateForIsMatchWithString = "public class CodeHelper {{ public bool IsMatch(string it) {{ {0} }} }}";
2424

@@ -63,17 +63,24 @@ public CSharpCodeMatcher(MatchBehaviour matchBehaviour, MatchOperator matchOpera
6363
Value = patterns;
6464
}
6565

66-
public MatchResult IsMatch(string? input)
67-
{
68-
return IsMatchInternal(input);
69-
}
66+
/// <inheritdoc />
67+
public MatchResult IsMatch(string? input) => IsMatchInternal(input);
7068

71-
public MatchResult IsMatch(object? input)
69+
/// <inheritdoc />
70+
public MatchResult IsMatch(object? input) => IsMatchInternal(input);
71+
72+
/// <inheritdoc />
73+
public string GetCSharpCodeArguments()
7274
{
73-
return IsMatchInternal(input);
75+
return $"new {Name}" +
76+
$"(" +
77+
$"{MatchBehaviour.GetFullyQualifiedEnumValue()}, " +
78+
$"{MatchOperator.GetFullyQualifiedEnumValue()}, " +
79+
$"{MappingConverterUtils.ToCSharpCodeArguments(_patterns)}" +
80+
$")";
7481
}
7582

76-
public MatchResult IsMatchInternal(object? input)
83+
private MatchResult IsMatchInternal(object? input)
7784
{
7885
var score = MatchScores.Mismatch;
7986
Exception? exception = null;
@@ -93,17 +100,6 @@ public MatchResult IsMatchInternal(object? input)
93100
return new MatchResult(MatchBehaviourHelper.Convert(MatchBehaviour, score), exception);
94101
}
95102

96-
/// <inheritdoc />
97-
public string GetCSharpCodeArguments()
98-
{
99-
return $"new {Name}" +
100-
$"(" +
101-
$"{MatchBehaviour.GetFullyQualifiedEnumValue()}, " +
102-
$"{MatchOperator.GetFullyQualifiedEnumValue()}, " +
103-
$"{MappingConverterUtils.ToCSharpCodeArguments(_patterns)}" +
104-
$")";
105-
}
106-
107103
private bool IsMatch(dynamic input, string pattern)
108104
{
109105
var isMatchWithString = input is string;

src/WireMock.Net.Shared/Matchers/ICSharpCodeMatcher.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,4 @@ namespace WireMock.Matchers;
77
/// </summary>
88
/// <inheritdoc cref="IObjectMatcher"/>
99
/// <inheritdoc cref="IStringMatcher"/>
10-
public interface ICSharpCodeMatcher : IObjectMatcher, IStringMatcher
11-
{
12-
}
10+
public interface ICSharpCodeMatcher : IObjectMatcher, IStringMatcher;

0 commit comments

Comments
 (0)