// Copyright © WireMock.Net using WireMock.Extensions; using WireMock.Util; namespace WireMock.Matchers; /// /// SystemTextJsonPartialWildcardMatcher - uses System.Text.Json instead of Newtonsoft.Json. /// public class SystemTextJsonPartialWildcardMatcher : AbstractSystemTextJsonPartialMatcher { /// public override string Name => nameof(SystemTextJsonPartialWildcardMatcher); /// public SystemTextJsonPartialWildcardMatcher(string value, bool ignoreCase = false, bool regex = false) : base(value, ignoreCase, regex) { } /// public SystemTextJsonPartialWildcardMatcher(object value, bool ignoreCase = false, bool regex = false) : base(value, ignoreCase, regex) { } /// public SystemTextJsonPartialWildcardMatcher(MatchBehaviour matchBehaviour, object value, bool ignoreCase = false, bool regex = false) : base(matchBehaviour, value, ignoreCase, regex) { } /// protected override bool IsMatch(string value, string input) { var wildcardStringMatcher = new WildcardMatcher(MatchBehaviour.AcceptOnMatch, value, IgnoreCase); return wildcardStringMatcher.IsMatch(input).IsPerfect(); } /// public override string GetCSharpCodeArguments() { return $"new {Name}" + $"(" + $"{MatchBehaviour.GetFullyQualifiedEnumValue()}, " + $"{CSharpFormatter.ConvertToAnonymousObjectDefinition(Value, 3)}, " + $"{CSharpFormatter.ToCSharpBooleanLiteral(IgnoreCase)}, " + $"{CSharpFormatter.ToCSharpBooleanLiteral(Regex)}" + $")"; } }