diff --git a/src/WireMock.Net.Matchers.CSharpCode/Matchers/CSharpCodeMatcher.cs b/src/WireMock.Net.Matchers.CSharpCode/Matchers/CSharpCodeMatcher.cs index f3a9a68ce..7e557b241 100644 --- a/src/WireMock.Net.Matchers.CSharpCode/Matchers/CSharpCodeMatcher.cs +++ b/src/WireMock.Net.Matchers.CSharpCode/Matchers/CSharpCodeMatcher.cs @@ -18,7 +18,7 @@ namespace WireMock.Matchers; /// CSharpCode / CS-Script Matcher /// /// -internal class CSharpCodeMatcher : ICSharpCodeMatcher +public class CSharpCodeMatcher : ICSharpCodeMatcher { private const string TemplateForIsMatchWithString = "public class CodeHelper {{ public bool IsMatch(string it) {{ {0} }} }}"; @@ -63,17 +63,24 @@ public CSharpCodeMatcher(MatchBehaviour matchBehaviour, MatchOperator matchOpera Value = patterns; } - public MatchResult IsMatch(string? input) - { - return IsMatchInternal(input); - } + /// + public MatchResult IsMatch(string? input) => IsMatchInternal(input); - public MatchResult IsMatch(object? input) + /// + public MatchResult IsMatch(object? input) => IsMatchInternal(input); + + /// + public string GetCSharpCodeArguments() { - return IsMatchInternal(input); + return $"new {Name}" + + $"(" + + $"{MatchBehaviour.GetFullyQualifiedEnumValue()}, " + + $"{MatchOperator.GetFullyQualifiedEnumValue()}, " + + $"{MappingConverterUtils.ToCSharpCodeArguments(_patterns)}" + + $")"; } - public MatchResult IsMatchInternal(object? input) + private MatchResult IsMatchInternal(object? input) { var score = MatchScores.Mismatch; Exception? exception = null; @@ -93,17 +100,6 @@ public MatchResult IsMatchInternal(object? input) return new MatchResult(MatchBehaviourHelper.Convert(MatchBehaviour, score), exception); } - /// - public string GetCSharpCodeArguments() - { - return $"new {Name}" + - $"(" + - $"{MatchBehaviour.GetFullyQualifiedEnumValue()}, " + - $"{MatchOperator.GetFullyQualifiedEnumValue()}, " + - $"{MappingConverterUtils.ToCSharpCodeArguments(_patterns)}" + - $")"; - } - private bool IsMatch(dynamic input, string pattern) { var isMatchWithString = input is string; diff --git a/src/WireMock.Net.Shared/Matchers/ICSharpCodeMatcher.cs b/src/WireMock.Net.Shared/Matchers/ICSharpCodeMatcher.cs index 32e358210..1f344aa95 100644 --- a/src/WireMock.Net.Shared/Matchers/ICSharpCodeMatcher.cs +++ b/src/WireMock.Net.Shared/Matchers/ICSharpCodeMatcher.cs @@ -7,6 +7,4 @@ namespace WireMock.Matchers; /// /// /// -public interface ICSharpCodeMatcher : IObjectMatcher, IStringMatcher -{ -} \ No newline at end of file +public interface ICSharpCodeMatcher : IObjectMatcher, IStringMatcher; \ No newline at end of file