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,12 +5,22 @@ using WireMock.Matchers.Request;
using WireMock.RequestBuilders; using WireMock.RequestBuilders;
using WireMock.ResponseBuilders; using WireMock.ResponseBuilders;
using WireMock.Util; using WireMock.Util;
using WireMock.Validation;
namespace WireMock.Serialization namespace WireMock.Serialization
{ {
internal static class MappingConverter internal class MappingConverter
{ {
public static MappingModel ToMappingModel(IMapping mapping) private readonly MatcherMapper _mapper;
public MappingConverter(MatcherMapper mapper)
{
Check.NotNull(mapper, nameof(mapper));
_mapper = mapper;
}
public MappingModel ToMappingModel(IMapping mapping)
{ {
var request = (Request)mapping.RequestMatcher; var request = (Request)mapping.RequestMatcher;
var response = (Response)mapping.Provider; var response = (Response)mapping.Provider;
@@ -36,17 +46,17 @@ namespace WireMock.Serialization
{ {
ClientIP = clientIPMatchers != null && clientIPMatchers.Any() ? new ClientIPModel ClientIP = clientIPMatchers != null && clientIPMatchers.Any() ? new ClientIPModel
{ {
Matchers = MatcherMapper.Map(clientIPMatchers.Where(m => m.Matchers != null).SelectMany(m => m.Matchers)) Matchers = _mapper.Map(clientIPMatchers.Where(m => m.Matchers != null).SelectMany(m => m.Matchers))
} : null, } : null,
Path = pathMatchers != null && pathMatchers.Any() ? new PathModel Path = pathMatchers != null && pathMatchers.Any() ? new PathModel
{ {
Matchers = MatcherMapper.Map(pathMatchers.Where(m => m.Matchers != null).SelectMany(m => m.Matchers)) Matchers = _mapper.Map(pathMatchers.Where(m => m.Matchers != null).SelectMany(m => m.Matchers))
} : null, } : null,
Url = urlMatchers != null && urlMatchers.Any() ? new UrlModel Url = urlMatchers != null && urlMatchers.Any() ? new UrlModel
{ {
Matchers = MatcherMapper.Map(urlMatchers.Where(m => m.Matchers != null).SelectMany(m => m.Matchers)) Matchers = _mapper.Map(urlMatchers.Where(m => m.Matchers != null).SelectMany(m => m.Matchers))
} : null, } : null,
Methods = methodMatcher?.Methods, Methods = methodMatcher?.Methods,
@@ -54,20 +64,20 @@ namespace WireMock.Serialization
Headers = headerMatchers != null && headerMatchers.Any() ? headerMatchers.Select(hm => new HeaderModel Headers = headerMatchers != null && headerMatchers.Any() ? headerMatchers.Select(hm => new HeaderModel
{ {
Name = hm.Name, Name = hm.Name,
Matchers = MatcherMapper.Map(hm.Matchers) Matchers = _mapper.Map(hm.Matchers)
}).ToList() : null, }).ToList() : null,
Cookies = cookieMatchers != null && cookieMatchers.Any() ? cookieMatchers.Select(cm => new CookieModel Cookies = cookieMatchers != null && cookieMatchers.Any() ? cookieMatchers.Select(cm => new CookieModel
{ {
Name = cm.Name, Name = cm.Name,
Matchers = MatcherMapper.Map(cm.Matchers) Matchers = _mapper.Map(cm.Matchers)
}).ToList() : null, }).ToList() : null,
Params = paramsMatchers != null && paramsMatchers.Any() ? paramsMatchers.Select(pm => new ParamModel Params = paramsMatchers != null && paramsMatchers.Any() ? paramsMatchers.Select(pm => new ParamModel
{ {
Name = pm.Key, Name = pm.Key,
IgnoreCase = pm.IgnoreCase == true ? true : (bool?)null, IgnoreCase = pm.IgnoreCase == true ? true : (bool?)null,
Matchers = MatcherMapper.Map(pm.Matchers) Matchers = _mapper.Map(pm.Matchers)
}).ToList() : null }).ToList() : null
}, },
Response = new ResponseModel Response = new ResponseModel
@@ -82,11 +92,11 @@ namespace WireMock.Serialization
if (bodyMatcher.Matchers.Length == 1) if (bodyMatcher.Matchers.Length == 1)
{ {
mappingModel.Request.Body.Matcher = MatcherMapper.Map(bodyMatcher.Matchers[0]); mappingModel.Request.Body.Matcher = _mapper.Map(bodyMatcher.Matchers[0]);
} }
else if (bodyMatcher.Matchers.Length > 1) else if (bodyMatcher.Matchers.Length > 1)
{ {
mappingModel.Request.Body.Matchers = MatcherMapper.Map(bodyMatcher.Matchers); mappingModel.Request.Body.Matchers = _mapper.Map(bodyMatcher.Matchers);
} }
} }

View File

@@ -5,17 +5,27 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using WireMock.Admin.Mappings; using WireMock.Admin.Mappings;
using WireMock.Matchers; using WireMock.Matchers;
using WireMock.Settings;
using WireMock.Validation;
namespace WireMock.Serialization 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(); 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) 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(); 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) if (matcher == null)
{ {

View File

@@ -369,7 +369,7 @@ namespace WireMock.Server
return ResponseMessageBuilder.Create("Mapping not found", 404); return ResponseMessageBuilder.Create("Mapping not found", 404);
} }
var model = MappingConverter.ToMappingModel(mapping); var model = _mappingConverter.ToMappingModel(mapping);
return ToJson(model); return ToJson(model);
} }
@@ -417,7 +417,7 @@ namespace WireMock.Server
_settings.FileSystemHandler.CreateFolder(folder); _settings.FileSystemHandler.CreateFolder(folder);
} }
var model = MappingConverter.ToMappingModel(mapping); var model = _mappingConverter.ToMappingModel(mapping);
string filename = (!string.IsNullOrEmpty(mapping.Title) ? SanitizeFileName(mapping.Title) : mapping.Guid.ToString()) + ".json"; string filename = (!string.IsNullOrEmpty(mapping.Title) ? SanitizeFileName(mapping.Title) : mapping.Guid.ToString()) + ".json";
string path = Path.Combine(folder, filename); string path = Path.Combine(folder, filename);
@@ -431,9 +431,10 @@ namespace WireMock.Server
{ {
return Path.GetInvalidFileNameChars().Aggregate(name, (current, c) => current.Replace(c, replaceChar)); return Path.GetInvalidFileNameChars().Aggregate(name, (current, c) => current.Replace(c, replaceChar));
} }
private IEnumerable<MappingModel> ToMappingModels() private IEnumerable<MappingModel> ToMappingModels()
{ {
return Mappings.Where(m => !m.IsAdminInterface).Select(MappingConverter.ToMappingModel); return Mappings.Where(m => !m.IsAdminInterface).Select(_mappingConverter.ToMappingModel);
} }
private ResponseMessage MappingsGet(RequestMessage requestMessage) private ResponseMessage MappingsGet(RequestMessage requestMessage)
@@ -641,7 +642,7 @@ namespace WireMock.Server
var clientIPModel = JsonUtils.ParseJTokenToObject<ClientIPModel>(requestModel.ClientIP); var clientIPModel = JsonUtils.ParseJTokenToObject<ClientIPModel>(requestModel.ClientIP);
if (clientIPModel?.Matchers != null) if (clientIPModel?.Matchers != null)
{ {
requestBuilder = requestBuilder.WithPath(clientIPModel.Matchers.Select(MatcherMapper.Map).Cast<IStringMatcher>().ToArray()); requestBuilder = requestBuilder.WithPath(clientIPModel.Matchers.Select(_matcherMapper.Map).Cast<IStringMatcher>().ToArray());
} }
} }
} }
@@ -659,7 +660,7 @@ namespace WireMock.Server
var pathModel = JsonUtils.ParseJTokenToObject<PathModel>(requestModel.Path); var pathModel = JsonUtils.ParseJTokenToObject<PathModel>(requestModel.Path);
if (pathModel?.Matchers != null) if (pathModel?.Matchers != null)
{ {
requestBuilder = requestBuilder.WithPath(pathModel.Matchers.Select(MatcherMapper.Map).Cast<IStringMatcher>().ToArray()); requestBuilder = requestBuilder.WithPath(pathModel.Matchers.Select(_matcherMapper.Map).Cast<IStringMatcher>().ToArray());
pathOrUrlmatchersValid = true; pathOrUrlmatchersValid = true;
} }
} }
@@ -676,7 +677,7 @@ namespace WireMock.Server
var urlModel = JsonUtils.ParseJTokenToObject<UrlModel>(requestModel.Url); var urlModel = JsonUtils.ParseJTokenToObject<UrlModel>(requestModel.Url);
if (urlModel?.Matchers != null) if (urlModel?.Matchers != null)
{ {
requestBuilder = requestBuilder.WithUrl(urlModel.Matchers.Select(MatcherMapper.Map).Cast<IStringMatcher>().ToArray()); requestBuilder = requestBuilder.WithUrl(urlModel.Matchers.Select(_matcherMapper.Map).Cast<IStringMatcher>().ToArray());
pathOrUrlmatchersValid = true; pathOrUrlmatchersValid = true;
} }
} }
@@ -697,7 +698,7 @@ namespace WireMock.Server
{ {
foreach (var headerModel in requestModel.Headers.Where(h => h.Matchers != null)) foreach (var headerModel in requestModel.Headers.Where(h => h.Matchers != null))
{ {
requestBuilder = requestBuilder.WithHeader(headerModel.Name, headerModel.Matchers.Select(MatcherMapper.Map).Cast<IStringMatcher>().ToArray()); requestBuilder = requestBuilder.WithHeader(headerModel.Name, headerModel.Matchers.Select(_matcherMapper.Map).Cast<IStringMatcher>().ToArray());
} }
} }
@@ -705,7 +706,7 @@ namespace WireMock.Server
{ {
foreach (var cookieModel in requestModel.Cookies.Where(c => c.Matchers != null)) foreach (var cookieModel in requestModel.Cookies.Where(c => c.Matchers != null))
{ {
requestBuilder = requestBuilder.WithCookie(cookieModel.Name, cookieModel.Matchers.Select(MatcherMapper.Map).Cast<IStringMatcher>().ToArray()); requestBuilder = requestBuilder.WithCookie(cookieModel.Name, cookieModel.Matchers.Select(_matcherMapper.Map).Cast<IStringMatcher>().ToArray());
} }
} }
@@ -714,17 +715,17 @@ namespace WireMock.Server
foreach (var paramModel in requestModel.Params.Where(c => c.Matchers != null)) foreach (var paramModel in requestModel.Params.Where(c => c.Matchers != null))
{ {
bool ignoreCase = paramModel?.IgnoreCase ?? false; bool ignoreCase = paramModel?.IgnoreCase ?? false;
requestBuilder = requestBuilder.WithParam(paramModel.Name, ignoreCase, paramModel.Matchers.Select(MatcherMapper.Map).Cast<IStringMatcher>().ToArray()); requestBuilder = requestBuilder.WithParam(paramModel.Name, ignoreCase, paramModel.Matchers.Select(_matcherMapper.Map).Cast<IStringMatcher>().ToArray());
} }
} }
if (requestModel.Body?.Matcher != null) if (requestModel.Body?.Matcher != null)
{ {
requestBuilder = requestBuilder.WithBody(MatcherMapper.Map(requestModel.Body.Matcher)); requestBuilder = requestBuilder.WithBody(_matcherMapper.Map(requestModel.Body.Matcher));
} }
else if (requestModel.Body?.Matchers != null) else if (requestModel.Body?.Matchers != null)
{ {
requestBuilder = requestBuilder.WithBody(MatcherMapper.Map(requestModel.Body.Matchers)); requestBuilder = requestBuilder.WithBody(_matcherMapper.Map(requestModel.Body.Matchers));
} }
return requestBuilder; return requestBuilder;

View File

@@ -15,6 +15,7 @@ using WireMock.Matchers.Request;
using WireMock.Owin; using WireMock.Owin;
using WireMock.RequestBuilders; using WireMock.RequestBuilders;
using WireMock.ResponseProviders; using WireMock.ResponseProviders;
using WireMock.Serialization;
using WireMock.Settings; using WireMock.Settings;
using WireMock.Util; using WireMock.Util;
using WireMock.Validation; using WireMock.Validation;
@@ -31,6 +32,8 @@ namespace WireMock.Server
private readonly IFluentMockServerSettings _settings; private readonly IFluentMockServerSettings _settings;
private readonly IOwinSelfHost _httpServer; private readonly IOwinSelfHost _httpServer;
private readonly IWireMockMiddlewareOptions _options = new WireMockMiddlewareOptions(); private readonly IWireMockMiddlewareOptions _options = new WireMockMiddlewareOptions();
private readonly MappingConverter _mappingConverter;
private readonly MatcherMapper _matcherMapper;
/// <summary> /// <summary>
/// Gets a value indicating whether this server is started. /// Gets a value indicating whether this server is started.
@@ -215,6 +218,9 @@ namespace WireMock.Server
_options.PostWireMockMiddlewareInit = settings.PostWireMockMiddlewareInit; _options.PostWireMockMiddlewareInit = settings.PostWireMockMiddlewareInit;
_options.Logger = _settings.Logger; _options.Logger = _settings.Logger;
_matcherMapper = new MatcherMapper(_settings);
_mappingConverter = new MappingConverter(_matcherMapper);
#if USE_ASPNETCORE #if USE_ASPNETCORE
_httpServer = new AspNetCoreSelfHost(_options, Urls); _httpServer = new AspNetCoreSelfHost(_options, Urls);
#else #else

View File

@@ -1,6 +1,6 @@
using FluentAssertions; using System;
using FluentAssertions;
using Moq; using Moq;
using System;
using WireMock.RequestBuilders; using WireMock.RequestBuilders;
using WireMock.ResponseBuilders; using WireMock.ResponseBuilders;
using WireMock.Serialization; using WireMock.Serialization;
@@ -13,6 +13,13 @@ namespace WireMock.Net.Tests.Serialization
{ {
private readonly Mock<IFluentMockServerSettings> _settingsMock = new Mock<IFluentMockServerSettings>(); private readonly Mock<IFluentMockServerSettings> _settingsMock = new Mock<IFluentMockServerSettings>();
private readonly MappingConverter _sut;
public MappingConverterTests()
{
_sut = new MappingConverter(new MatcherMapper(_settingsMock.Object));
}
[Fact] [Fact]
public void ToMappingModel() public void ToMappingModel()
{ {
@@ -22,7 +29,7 @@ namespace WireMock.Net.Tests.Serialization
var mapping = new Mapping(Guid.NewGuid(), "", null, _settingsMock.Object, request, response, 0, null, null, null); var mapping = new Mapping(Guid.NewGuid(), "", null, _settingsMock.Object, request, response, 0, null, null, null);
// Act // Act
var model = MappingConverter.ToMappingModel(mapping); var model = _sut.ToMappingModel(mapping);
// Assert // Assert
model.Should().NotBeNull(); model.Should().NotBeNull();
@@ -40,7 +47,7 @@ namespace WireMock.Net.Tests.Serialization
var mapping = new Mapping(Guid.NewGuid(), "", null, _settingsMock.Object, request, response, 42, null, null, null); var mapping = new Mapping(Guid.NewGuid(), "", null, _settingsMock.Object, request, response, 42, null, null, null);
// Act // Act
var model = MappingConverter.ToMappingModel(mapping); var model = _sut.ToMappingModel(mapping);
// Assert // Assert
model.Should().NotBeNull(); model.Should().NotBeNull();

View File

@@ -4,17 +4,30 @@ using NFluent;
using WireMock.Admin.Mappings; using WireMock.Admin.Mappings;
using WireMock.Matchers; using WireMock.Matchers;
using WireMock.Serialization; using WireMock.Serialization;
using WireMock.Settings;
using Xunit; using Xunit;
namespace WireMock.Net.Tests.Serialization namespace WireMock.Net.Tests.Serialization
{ {
public class MatcherMapperTests public class MatcherMapperTests
{ {
private readonly Mock<IFluentMockServerSettings> _settingsMock;
private readonly MatcherMapper _sut;
public MatcherMapperTests()
{
_settingsMock = new Mock<IFluentMockServerSettings>();
_settingsMock.SetupAllProperties();
_sut = new MatcherMapper(_settingsMock.Object);
}
[Fact] [Fact]
public void MatcherMapper_Map_IMatcher_Null() public void MatcherMapper_Map_IMatcher_Null()
{ {
// Act // Act
var model = MatcherMapper.Map((IMatcher)null); var model = _sut.Map((IMatcher)null);
// Assert // Assert
Check.That(model).IsNull(); Check.That(model).IsNull();
@@ -24,7 +37,7 @@ namespace WireMock.Net.Tests.Serialization
public void MatcherMapper_Map_IMatchers_Null() public void MatcherMapper_Map_IMatchers_Null()
{ {
// Act // Act
var model = MatcherMapper.Map((IMatcher[])null); var model = _sut.Map((IMatcher[])null);
// Assert // Assert
Check.That(model).IsNull(); Check.That(model).IsNull();
@@ -38,7 +51,7 @@ namespace WireMock.Net.Tests.Serialization
var matcherMock2 = new Mock<IStringMatcher>(); var matcherMock2 = new Mock<IStringMatcher>();
// Act // Act
var models = MatcherMapper.Map(new[] { matcherMock1.Object, matcherMock2.Object }); var models = _sut.Map(new[] { matcherMock1.Object, matcherMock2.Object });
// Assert // Assert
Check.That(models).HasSize(2); Check.That(models).HasSize(2);
@@ -53,7 +66,7 @@ namespace WireMock.Net.Tests.Serialization
matcherMock.Setup(m => m.GetPatterns()).Returns(new[] { "p1", "p2" }); matcherMock.Setup(m => m.GetPatterns()).Returns(new[] { "p1", "p2" });
// Act // Act
var model = MatcherMapper.Map(matcherMock.Object); var model = _sut.Map(matcherMock.Object);
// Assert // Assert
Check.That(model.IgnoreCase).IsNull(); Check.That(model.IgnoreCase).IsNull();
@@ -70,7 +83,7 @@ namespace WireMock.Net.Tests.Serialization
matcherMock.Setup(m => m.IgnoreCase).Returns(true); matcherMock.Setup(m => m.IgnoreCase).Returns(true);
// Act // Act
var model = MatcherMapper.Map(matcherMock.Object); var model = _sut.Map(matcherMock.Object);
// Assert // Assert
Check.That(model.IgnoreCase).Equals(true); Check.That(model.IgnoreCase).Equals(true);
@@ -80,7 +93,7 @@ namespace WireMock.Net.Tests.Serialization
public void MatcherMapper_Map_MatcherModel_Null() public void MatcherMapper_Map_MatcherModel_Null()
{ {
// Act // Act
var result = MatcherMapper.Map((MatcherModel)null); var result = _sut.Map((MatcherModel)null);
// Assert // Assert
Check.That(result).IsNull(); Check.That(result).IsNull();
@@ -93,7 +106,7 @@ namespace WireMock.Net.Tests.Serialization
var model = new MatcherModel { Name = "test" }; var model = new MatcherModel { Name = "test" };
// Act and Assert // Act and Assert
Check.ThatCode(() => MatcherMapper.Map(model)).Throws<NotSupportedException>(); Check.ThatCode(() => _sut.Map(model)).Throws<NotSupportedException>();
} }
[Fact] [Fact]
@@ -107,7 +120,7 @@ namespace WireMock.Net.Tests.Serialization
}; };
// Act // Act
var matcher = (LinqMatcher)MatcherMapper.Map(model); var matcher = (LinqMatcher)_sut.Map(model);
// Assert // Assert
Check.That(matcher.MatchBehaviour).IsEqualTo(MatchBehaviour.AcceptOnMatch); Check.That(matcher.MatchBehaviour).IsEqualTo(MatchBehaviour.AcceptOnMatch);
@@ -125,7 +138,7 @@ namespace WireMock.Net.Tests.Serialization
}; };
// Act // Act
var matcher = (LinqMatcher)MatcherMapper.Map(model); var matcher = (LinqMatcher)_sut.Map(model);
// Assert // Assert
Check.That(matcher.MatchBehaviour).IsEqualTo(MatchBehaviour.AcceptOnMatch); Check.That(matcher.MatchBehaviour).IsEqualTo(MatchBehaviour.AcceptOnMatch);

View File

@@ -1,19 +1,33 @@
using NFluent; using NFluent;
using System; using System;
using Moq;
using WireMock.Admin.Mappings; using WireMock.Admin.Mappings;
using WireMock.Matchers; using WireMock.Matchers;
using WireMock.Serialization; using WireMock.Serialization;
using WireMock.Settings;
using Xunit; using Xunit;
namespace WireMock.Net.Tests.Serialization namespace WireMock.Net.Tests.Serialization
{ {
public class MatcherModelMapperTests public class MatcherModelMapperTests
{ {
private readonly Mock<IFluentMockServerSettings> _settingsMock;
private readonly MatcherMapper _sut;
public MatcherModelMapperTests()
{
_settingsMock = new Mock<IFluentMockServerSettings>();
_settingsMock.SetupAllProperties();
_sut = new MatcherMapper(_settingsMock.Object);
}
[Fact] [Fact]
public void MatcherModelMapper_Map_Null() public void MatcherModelMapper_Map_Null()
{ {
// Act // Act
IMatcher matcher = MatcherMapper.Map((MatcherModel)null); IMatcher matcher = _sut.Map((MatcherModel)null);
// Assert // Assert
Check.That(matcher).IsNull(); Check.That(matcher).IsNull();
@@ -30,7 +44,7 @@ namespace WireMock.Net.Tests.Serialization
}; };
// Act // Act
var matcher = (ExactMatcher)MatcherMapper.Map(model); var matcher = (ExactMatcher)_sut.Map(model);
// Assert // Assert
Check.That(matcher.GetPatterns()).ContainsExactly("x"); Check.That(matcher.GetPatterns()).ContainsExactly("x");
@@ -47,7 +61,7 @@ namespace WireMock.Net.Tests.Serialization
}; };
// Act // Act
var matcher = (ExactMatcher)MatcherMapper.Map(model); var matcher = (ExactMatcher)_sut.Map(model);
// Assert // Assert
Check.That(matcher.GetPatterns()).ContainsExactly("x", "y"); Check.That(matcher.GetPatterns()).ContainsExactly("x", "y");
@@ -64,7 +78,7 @@ namespace WireMock.Net.Tests.Serialization
}; };
// Act // Act
var matcher = (ExactObjectMatcher)MatcherMapper.Map(model); var matcher = (ExactObjectMatcher)_sut.Map(model);
// Assert // Assert
Check.That(matcher.ValueAsBytes).ContainsExactly(new byte[] { 115, 116, 101, 102 }); Check.That(matcher.ValueAsBytes).ContainsExactly(new byte[] { 115, 116, 101, 102 });
@@ -82,7 +96,7 @@ namespace WireMock.Net.Tests.Serialization
}; };
// Act // Act
var matcher = (RegexMatcher)MatcherMapper.Map(model); var matcher = (RegexMatcher)_sut.Map(model);
// Assert // Assert
Check.That(matcher.GetPatterns()).ContainsExactly("x", "y"); Check.That(matcher.GetPatterns()).ContainsExactly("x", "y");
@@ -101,7 +115,7 @@ namespace WireMock.Net.Tests.Serialization
}; };
// Act // Act
var matcher = (WildcardMatcher)MatcherMapper.Map(model); var matcher = (WildcardMatcher)_sut.Map(model);
// Assert // Assert
Check.That(matcher.GetPatterns()).ContainsExactly("x", "y"); Check.That(matcher.GetPatterns()).ContainsExactly("x", "y");
@@ -119,7 +133,7 @@ namespace WireMock.Net.Tests.Serialization
}; };
// Act // Act
var matcher = (SimMetricsMatcher)MatcherMapper.Map(model); var matcher = (SimMetricsMatcher)_sut.Map(model);
// Assert // Assert
Check.That(matcher.GetPatterns()).ContainsExactly("x"); Check.That(matcher.GetPatterns()).ContainsExactly("x");
@@ -136,7 +150,7 @@ namespace WireMock.Net.Tests.Serialization
}; };
// Act // Act
var matcher = (SimMetricsMatcher)MatcherMapper.Map(model); var matcher = (SimMetricsMatcher)_sut.Map(model);
// Assert // Assert
Check.That(matcher.GetPatterns()).ContainsExactly("x"); Check.That(matcher.GetPatterns()).ContainsExactly("x");
@@ -153,7 +167,7 @@ namespace WireMock.Net.Tests.Serialization
}; };
// Act // Act
Check.ThatCode(() => MatcherMapper.Map(model)).Throws<NotSupportedException>(); Check.ThatCode(() => _sut.Map(model)).Throws<NotSupportedException>();
} }
[Fact] [Fact]
@@ -167,7 +181,7 @@ namespace WireMock.Net.Tests.Serialization
}; };
// Act // Act
Check.ThatCode(() => MatcherMapper.Map(model)).Throws<NotSupportedException>(); Check.ThatCode(() => _sut.Map(model)).Throws<NotSupportedException>();
} }
} }
} }