mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 22:30:41 +01:00
Refactor MappingConverter & MatcherMapper (#323)
This commit is contained in:
@@ -5,12 +5,22 @@ using WireMock.Matchers.Request;
|
||||
using WireMock.RequestBuilders;
|
||||
using WireMock.ResponseBuilders;
|
||||
using WireMock.Util;
|
||||
using WireMock.Validation;
|
||||
|
||||
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 response = (Response)mapping.Provider;
|
||||
@@ -36,17 +46,17 @@ namespace WireMock.Serialization
|
||||
{
|
||||
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,
|
||||
|
||||
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,
|
||||
|
||||
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,
|
||||
|
||||
Methods = methodMatcher?.Methods,
|
||||
@@ -54,20 +64,20 @@ namespace WireMock.Serialization
|
||||
Headers = headerMatchers != null && headerMatchers.Any() ? headerMatchers.Select(hm => new HeaderModel
|
||||
{
|
||||
Name = hm.Name,
|
||||
Matchers = MatcherMapper.Map(hm.Matchers)
|
||||
Matchers = _mapper.Map(hm.Matchers)
|
||||
}).ToList() : null,
|
||||
|
||||
Cookies = cookieMatchers != null && cookieMatchers.Any() ? cookieMatchers.Select(cm => new CookieModel
|
||||
{
|
||||
Name = cm.Name,
|
||||
Matchers = MatcherMapper.Map(cm.Matchers)
|
||||
Matchers = _mapper.Map(cm.Matchers)
|
||||
}).ToList() : null,
|
||||
|
||||
Params = paramsMatchers != null && paramsMatchers.Any() ? paramsMatchers.Select(pm => new ParamModel
|
||||
{
|
||||
Name = pm.Key,
|
||||
IgnoreCase = pm.IgnoreCase == true ? true : (bool?)null,
|
||||
Matchers = MatcherMapper.Map(pm.Matchers)
|
||||
Matchers = _mapper.Map(pm.Matchers)
|
||||
}).ToList() : null
|
||||
},
|
||||
Response = new ResponseModel
|
||||
@@ -82,11 +92,11 @@ namespace WireMock.Serialization
|
||||
|
||||
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)
|
||||
{
|
||||
mappingModel.Request.Body.Matchers = MatcherMapper.Map(bodyMatcher.Matchers);
|
||||
mappingModel.Request.Body.Matchers = _mapper.Map(bodyMatcher.Matchers);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -369,7 +369,7 @@ namespace WireMock.Server
|
||||
return ResponseMessageBuilder.Create("Mapping not found", 404);
|
||||
}
|
||||
|
||||
var model = MappingConverter.ToMappingModel(mapping);
|
||||
var model = _mappingConverter.ToMappingModel(mapping);
|
||||
|
||||
return ToJson(model);
|
||||
}
|
||||
@@ -417,7 +417,7 @@ namespace WireMock.Server
|
||||
_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 path = Path.Combine(folder, filename);
|
||||
@@ -431,9 +431,10 @@ namespace WireMock.Server
|
||||
{
|
||||
return Path.GetInvalidFileNameChars().Aggregate(name, (current, c) => current.Replace(c, replaceChar));
|
||||
}
|
||||
|
||||
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)
|
||||
@@ -641,7 +642,7 @@ namespace WireMock.Server
|
||||
var clientIPModel = JsonUtils.ParseJTokenToObject<ClientIPModel>(requestModel.ClientIP);
|
||||
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);
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -676,7 +677,7 @@ namespace WireMock.Server
|
||||
var urlModel = JsonUtils.ParseJTokenToObject<UrlModel>(requestModel.Url);
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -697,7 +698,7 @@ namespace WireMock.Server
|
||||
{
|
||||
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))
|
||||
{
|
||||
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))
|
||||
{
|
||||
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)
|
||||
{
|
||||
requestBuilder = requestBuilder.WithBody(MatcherMapper.Map(requestModel.Body.Matcher));
|
||||
requestBuilder = requestBuilder.WithBody(_matcherMapper.Map(requestModel.Body.Matcher));
|
||||
}
|
||||
else if (requestModel.Body?.Matchers != null)
|
||||
{
|
||||
requestBuilder = requestBuilder.WithBody(MatcherMapper.Map(requestModel.Body.Matchers));
|
||||
requestBuilder = requestBuilder.WithBody(_matcherMapper.Map(requestModel.Body.Matchers));
|
||||
}
|
||||
|
||||
return requestBuilder;
|
||||
|
||||
@@ -15,6 +15,7 @@ using WireMock.Matchers.Request;
|
||||
using WireMock.Owin;
|
||||
using WireMock.RequestBuilders;
|
||||
using WireMock.ResponseProviders;
|
||||
using WireMock.Serialization;
|
||||
using WireMock.Settings;
|
||||
using WireMock.Util;
|
||||
using WireMock.Validation;
|
||||
@@ -31,6 +32,8 @@ namespace WireMock.Server
|
||||
private readonly IFluentMockServerSettings _settings;
|
||||
private readonly IOwinSelfHost _httpServer;
|
||||
private readonly IWireMockMiddlewareOptions _options = new WireMockMiddlewareOptions();
|
||||
private readonly MappingConverter _mappingConverter;
|
||||
private readonly MatcherMapper _matcherMapper;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this server is started.
|
||||
@@ -215,6 +218,9 @@ namespace WireMock.Server
|
||||
_options.PostWireMockMiddlewareInit = settings.PostWireMockMiddlewareInit;
|
||||
_options.Logger = _settings.Logger;
|
||||
|
||||
_matcherMapper = new MatcherMapper(_settings);
|
||||
_mappingConverter = new MappingConverter(_matcherMapper);
|
||||
|
||||
#if USE_ASPNETCORE
|
||||
_httpServer = new AspNetCoreSelfHost(_options, Urls);
|
||||
#else
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using FluentAssertions;
|
||||
using System;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using System;
|
||||
using WireMock.RequestBuilders;
|
||||
using WireMock.ResponseBuilders;
|
||||
using WireMock.Serialization;
|
||||
@@ -13,6 +13,13 @@ namespace WireMock.Net.Tests.Serialization
|
||||
{
|
||||
private readonly Mock<IFluentMockServerSettings> _settingsMock = new Mock<IFluentMockServerSettings>();
|
||||
|
||||
private readonly MappingConverter _sut;
|
||||
|
||||
public MappingConverterTests()
|
||||
{
|
||||
_sut = new MappingConverter(new MatcherMapper(_settingsMock.Object));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
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);
|
||||
|
||||
// Act
|
||||
var model = MappingConverter.ToMappingModel(mapping);
|
||||
var model = _sut.ToMappingModel(mapping);
|
||||
|
||||
// Assert
|
||||
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);
|
||||
|
||||
// Act
|
||||
var model = MappingConverter.ToMappingModel(mapping);
|
||||
var model = _sut.ToMappingModel(mapping);
|
||||
|
||||
// Assert
|
||||
model.Should().NotBeNull();
|
||||
|
||||
@@ -4,17 +4,30 @@ using NFluent;
|
||||
using WireMock.Admin.Mappings;
|
||||
using WireMock.Matchers;
|
||||
using WireMock.Serialization;
|
||||
using WireMock.Settings;
|
||||
using Xunit;
|
||||
|
||||
namespace WireMock.Net.Tests.Serialization
|
||||
{
|
||||
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]
|
||||
public void MatcherMapper_Map_IMatcher_Null()
|
||||
{
|
||||
// Act
|
||||
var model = MatcherMapper.Map((IMatcher)null);
|
||||
var model = _sut.Map((IMatcher)null);
|
||||
|
||||
// Assert
|
||||
Check.That(model).IsNull();
|
||||
@@ -24,7 +37,7 @@ namespace WireMock.Net.Tests.Serialization
|
||||
public void MatcherMapper_Map_IMatchers_Null()
|
||||
{
|
||||
// Act
|
||||
var model = MatcherMapper.Map((IMatcher[])null);
|
||||
var model = _sut.Map((IMatcher[])null);
|
||||
|
||||
// Assert
|
||||
Check.That(model).IsNull();
|
||||
@@ -38,7 +51,7 @@ namespace WireMock.Net.Tests.Serialization
|
||||
var matcherMock2 = new Mock<IStringMatcher>();
|
||||
|
||||
// Act
|
||||
var models = MatcherMapper.Map(new[] { matcherMock1.Object, matcherMock2.Object });
|
||||
var models = _sut.Map(new[] { matcherMock1.Object, matcherMock2.Object });
|
||||
|
||||
// Assert
|
||||
Check.That(models).HasSize(2);
|
||||
@@ -53,7 +66,7 @@ namespace WireMock.Net.Tests.Serialization
|
||||
matcherMock.Setup(m => m.GetPatterns()).Returns(new[] { "p1", "p2" });
|
||||
|
||||
// Act
|
||||
var model = MatcherMapper.Map(matcherMock.Object);
|
||||
var model = _sut.Map(matcherMock.Object);
|
||||
|
||||
// Assert
|
||||
Check.That(model.IgnoreCase).IsNull();
|
||||
@@ -70,7 +83,7 @@ namespace WireMock.Net.Tests.Serialization
|
||||
matcherMock.Setup(m => m.IgnoreCase).Returns(true);
|
||||
|
||||
// Act
|
||||
var model = MatcherMapper.Map(matcherMock.Object);
|
||||
var model = _sut.Map(matcherMock.Object);
|
||||
|
||||
// Assert
|
||||
Check.That(model.IgnoreCase).Equals(true);
|
||||
@@ -80,7 +93,7 @@ namespace WireMock.Net.Tests.Serialization
|
||||
public void MatcherMapper_Map_MatcherModel_Null()
|
||||
{
|
||||
// Act
|
||||
var result = MatcherMapper.Map((MatcherModel)null);
|
||||
var result = _sut.Map((MatcherModel)null);
|
||||
|
||||
// Assert
|
||||
Check.That(result).IsNull();
|
||||
@@ -93,7 +106,7 @@ namespace WireMock.Net.Tests.Serialization
|
||||
var model = new MatcherModel { Name = "test" };
|
||||
|
||||
// Act and Assert
|
||||
Check.ThatCode(() => MatcherMapper.Map(model)).Throws<NotSupportedException>();
|
||||
Check.ThatCode(() => _sut.Map(model)).Throws<NotSupportedException>();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -107,7 +120,7 @@ namespace WireMock.Net.Tests.Serialization
|
||||
};
|
||||
|
||||
// Act
|
||||
var matcher = (LinqMatcher)MatcherMapper.Map(model);
|
||||
var matcher = (LinqMatcher)_sut.Map(model);
|
||||
|
||||
// Assert
|
||||
Check.That(matcher.MatchBehaviour).IsEqualTo(MatchBehaviour.AcceptOnMatch);
|
||||
@@ -125,7 +138,7 @@ namespace WireMock.Net.Tests.Serialization
|
||||
};
|
||||
|
||||
// Act
|
||||
var matcher = (LinqMatcher)MatcherMapper.Map(model);
|
||||
var matcher = (LinqMatcher)_sut.Map(model);
|
||||
|
||||
// Assert
|
||||
Check.That(matcher.MatchBehaviour).IsEqualTo(MatchBehaviour.AcceptOnMatch);
|
||||
|
||||
@@ -1,19 +1,33 @@
|
||||
using NFluent;
|
||||
using System;
|
||||
using Moq;
|
||||
using WireMock.Admin.Mappings;
|
||||
using WireMock.Matchers;
|
||||
using WireMock.Serialization;
|
||||
using WireMock.Settings;
|
||||
using Xunit;
|
||||
|
||||
namespace WireMock.Net.Tests.Serialization
|
||||
{
|
||||
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]
|
||||
public void MatcherModelMapper_Map_Null()
|
||||
{
|
||||
// Act
|
||||
IMatcher matcher = MatcherMapper.Map((MatcherModel)null);
|
||||
IMatcher matcher = _sut.Map((MatcherModel)null);
|
||||
|
||||
// Assert
|
||||
Check.That(matcher).IsNull();
|
||||
@@ -30,7 +44,7 @@ namespace WireMock.Net.Tests.Serialization
|
||||
};
|
||||
|
||||
// Act
|
||||
var matcher = (ExactMatcher)MatcherMapper.Map(model);
|
||||
var matcher = (ExactMatcher)_sut.Map(model);
|
||||
|
||||
// Assert
|
||||
Check.That(matcher.GetPatterns()).ContainsExactly("x");
|
||||
@@ -47,7 +61,7 @@ namespace WireMock.Net.Tests.Serialization
|
||||
};
|
||||
|
||||
// Act
|
||||
var matcher = (ExactMatcher)MatcherMapper.Map(model);
|
||||
var matcher = (ExactMatcher)_sut.Map(model);
|
||||
|
||||
// Assert
|
||||
Check.That(matcher.GetPatterns()).ContainsExactly("x", "y");
|
||||
@@ -64,7 +78,7 @@ namespace WireMock.Net.Tests.Serialization
|
||||
};
|
||||
|
||||
// Act
|
||||
var matcher = (ExactObjectMatcher)MatcherMapper.Map(model);
|
||||
var matcher = (ExactObjectMatcher)_sut.Map(model);
|
||||
|
||||
// Assert
|
||||
Check.That(matcher.ValueAsBytes).ContainsExactly(new byte[] { 115, 116, 101, 102 });
|
||||
@@ -82,7 +96,7 @@ namespace WireMock.Net.Tests.Serialization
|
||||
};
|
||||
|
||||
// Act
|
||||
var matcher = (RegexMatcher)MatcherMapper.Map(model);
|
||||
var matcher = (RegexMatcher)_sut.Map(model);
|
||||
|
||||
// Assert
|
||||
Check.That(matcher.GetPatterns()).ContainsExactly("x", "y");
|
||||
@@ -101,7 +115,7 @@ namespace WireMock.Net.Tests.Serialization
|
||||
};
|
||||
|
||||
// Act
|
||||
var matcher = (WildcardMatcher)MatcherMapper.Map(model);
|
||||
var matcher = (WildcardMatcher)_sut.Map(model);
|
||||
|
||||
// Assert
|
||||
Check.That(matcher.GetPatterns()).ContainsExactly("x", "y");
|
||||
@@ -119,7 +133,7 @@ namespace WireMock.Net.Tests.Serialization
|
||||
};
|
||||
|
||||
// Act
|
||||
var matcher = (SimMetricsMatcher)MatcherMapper.Map(model);
|
||||
var matcher = (SimMetricsMatcher)_sut.Map(model);
|
||||
|
||||
// Assert
|
||||
Check.That(matcher.GetPatterns()).ContainsExactly("x");
|
||||
@@ -136,7 +150,7 @@ namespace WireMock.Net.Tests.Serialization
|
||||
};
|
||||
|
||||
// Act
|
||||
var matcher = (SimMetricsMatcher)MatcherMapper.Map(model);
|
||||
var matcher = (SimMetricsMatcher)_sut.Map(model);
|
||||
|
||||
// Assert
|
||||
Check.That(matcher.GetPatterns()).ContainsExactly("x");
|
||||
@@ -153,7 +167,7 @@ namespace WireMock.Net.Tests.Serialization
|
||||
};
|
||||
|
||||
// Act
|
||||
Check.ThatCode(() => MatcherMapper.Map(model)).Throws<NotSupportedException>();
|
||||
Check.ThatCode(() => _sut.Map(model)).Throws<NotSupportedException>();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -167,7 +181,7 @@ namespace WireMock.Net.Tests.Serialization
|
||||
};
|
||||
|
||||
// Act
|
||||
Check.ThatCode(() => MatcherMapper.Map(model)).Throws<NotSupportedException>();
|
||||
Check.ThatCode(() => _sut.Map(model)).Throws<NotSupportedException>();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user