Refactor MappingConverter & MatcherMapper (#323)

This commit is contained in:
Stef Heyenrath
2019-08-17 17:00:44 +00:00
committed by GitHub
parent 94f179ba17
commit d55e2fb920
7 changed files with 110 additions and 49 deletions

View File

@@ -5,17 +5,27 @@ using System.Collections.Generic;
using System.Linq;
using WireMock.Admin.Mappings;
using WireMock.Matchers;
using WireMock.Settings;
using WireMock.Validation;
namespace WireMock.Serialization
{
internal static class MatcherMapper
internal class MatcherMapper
{
public static IMatcher[] Map([CanBeNull] IEnumerable<MatcherModel> matchers)
private readonly IFluentMockServerSettings _settings;
public MatcherMapper(IFluentMockServerSettings settings)
{
Check.NotNull(settings, nameof(settings));
_settings = settings;
}
public IMatcher[] Map([CanBeNull] IEnumerable<MatcherModel> matchers)
{
return matchers?.Select(Map).Where(m => m != null).ToArray();
}
public static IMatcher Map([CanBeNull] MatcherModel matcher)
public IMatcher Map([CanBeNull] MatcherModel matcher)
{
if (matcher == null)
{
@@ -73,12 +83,12 @@ namespace WireMock.Serialization
}
}
public static MatcherModel[] Map([CanBeNull] IEnumerable<IMatcher> matchers)
public MatcherModel[] Map([CanBeNull] IEnumerable<IMatcher> matchers)
{
return matchers?.Select(Map).Where(m => m != null).ToArray();
}
public static MatcherModel Map([CanBeNull] IMatcher matcher)
public MatcherModel Map([CanBeNull] IMatcher matcher)
{
if (matcher == null)
{