mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-22 08:48:46 +02:00
Fix MappingModel to map IgnoreCase and RejectOnMatch for Headers, Cookies and Parameters (#1004)
This commit is contained in:
@@ -16,6 +16,11 @@ public class ParamModel
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool? IgnoreCase { get; set; }
|
public bool? IgnoreCase { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Reject on match for the Param Name.
|
||||||
|
/// </summary>
|
||||||
|
public bool? RejectOnMatch { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the matchers.
|
/// Gets or sets the matchers.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -11,9 +11,15 @@ namespace WireMock.Matchers.Request;
|
|||||||
/// <inheritdoc cref="IRequestMatcher"/>
|
/// <inheritdoc cref="IRequestMatcher"/>
|
||||||
public class RequestMessageCookieMatcher : IRequestMatcher
|
public class RequestMessageCookieMatcher : IRequestMatcher
|
||||||
{
|
{
|
||||||
private readonly MatchBehaviour _matchBehaviour;
|
/// <summary>
|
||||||
|
/// MatchBehaviour
|
||||||
|
/// </summary>
|
||||||
|
public MatchBehaviour MatchBehaviour { get; }
|
||||||
|
|
||||||
private readonly bool _ignoreCase;
|
/// <summary>
|
||||||
|
/// IgnoreCase
|
||||||
|
/// </summary>
|
||||||
|
public bool IgnoreCase { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The functions
|
/// The functions
|
||||||
@@ -39,8 +45,8 @@ public class RequestMessageCookieMatcher : IRequestMatcher
|
|||||||
/// <param name="matchBehaviour">The match behaviour.</param>
|
/// <param name="matchBehaviour">The match behaviour.</param>
|
||||||
public RequestMessageCookieMatcher(MatchBehaviour matchBehaviour, string name, string pattern, bool ignoreCase)
|
public RequestMessageCookieMatcher(MatchBehaviour matchBehaviour, string name, string pattern, bool ignoreCase)
|
||||||
{
|
{
|
||||||
_matchBehaviour = matchBehaviour;
|
MatchBehaviour = matchBehaviour;
|
||||||
_ignoreCase = ignoreCase;
|
IgnoreCase = ignoreCase;
|
||||||
Name = Guard.NotNull(name);
|
Name = Guard.NotNull(name);
|
||||||
Matchers = new IStringMatcher[] { new WildcardMatcher(matchBehaviour, Guard.NotNull(pattern), ignoreCase) };
|
Matchers = new IStringMatcher[] { new WildcardMatcher(matchBehaviour, Guard.NotNull(pattern), ignoreCase) };
|
||||||
}
|
}
|
||||||
@@ -67,10 +73,10 @@ public class RequestMessageCookieMatcher : IRequestMatcher
|
|||||||
/// <param name="ignoreCase">Ignore the case from the pattern.</param>
|
/// <param name="ignoreCase">Ignore the case from the pattern.</param>
|
||||||
public RequestMessageCookieMatcher(MatchBehaviour matchBehaviour, string name, bool ignoreCase, params IStringMatcher[] matchers)
|
public RequestMessageCookieMatcher(MatchBehaviour matchBehaviour, string name, bool ignoreCase, params IStringMatcher[] matchers)
|
||||||
{
|
{
|
||||||
_matchBehaviour = matchBehaviour;
|
MatchBehaviour = matchBehaviour;
|
||||||
Name = Guard.NotNull(name);
|
Name = Guard.NotNull(name);
|
||||||
Matchers = Guard.NotNull(matchers);
|
Matchers = Guard.NotNull(matchers);
|
||||||
_ignoreCase = ignoreCase;
|
IgnoreCase = ignoreCase;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -96,11 +102,11 @@ public class RequestMessageCookieMatcher : IRequestMatcher
|
|||||||
{
|
{
|
||||||
if (requestMessage.Cookies == null)
|
if (requestMessage.Cookies == null)
|
||||||
{
|
{
|
||||||
return MatchBehaviourHelper.Convert(_matchBehaviour, MatchScores.Mismatch);
|
return MatchBehaviourHelper.Convert(MatchBehaviour, MatchScores.Mismatch);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if we want to use IgnoreCase to compare the Cookie-Name and Cookie-Value
|
// Check if we want to use IgnoreCase to compare the Cookie-Name and Cookie-Value
|
||||||
var cookies = !_ignoreCase ? requestMessage.Cookies : new Dictionary<string, string>(requestMessage.Cookies, StringComparer.OrdinalIgnoreCase);
|
var cookies = !IgnoreCase ? requestMessage.Cookies : new Dictionary<string, string>(requestMessage.Cookies, StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
if (Funcs != null)
|
if (Funcs != null)
|
||||||
{
|
{
|
||||||
@@ -114,7 +120,7 @@ public class RequestMessageCookieMatcher : IRequestMatcher
|
|||||||
|
|
||||||
if (!cookies.ContainsKey(Name))
|
if (!cookies.ContainsKey(Name))
|
||||||
{
|
{
|
||||||
return MatchBehaviourHelper.Convert(_matchBehaviour, MatchScores.Mismatch);
|
return MatchBehaviourHelper.Convert(MatchBehaviour, MatchScores.Mismatch);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Matchers.Max(m => m.IsMatch(cookies[Name]));
|
return Matchers.Max(m => m.IsMatch(cookies[Name]));
|
||||||
|
|||||||
@@ -12,8 +12,15 @@ namespace WireMock.Matchers.Request;
|
|||||||
/// <inheritdoc cref="IRequestMatcher"/>
|
/// <inheritdoc cref="IRequestMatcher"/>
|
||||||
public class RequestMessageHeaderMatcher : IRequestMatcher
|
public class RequestMessageHeaderMatcher : IRequestMatcher
|
||||||
{
|
{
|
||||||
private readonly MatchBehaviour _matchBehaviour;
|
/// <summary>
|
||||||
private readonly bool _ignoreCase;
|
/// MatchBehaviour
|
||||||
|
/// </summary>
|
||||||
|
public MatchBehaviour MatchBehaviour { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// IgnoreCase
|
||||||
|
/// </summary>
|
||||||
|
public bool IgnoreCase { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The functions
|
/// The functions
|
||||||
@@ -47,8 +54,8 @@ public class RequestMessageHeaderMatcher : IRequestMatcher
|
|||||||
Guard.NotNull(name);
|
Guard.NotNull(name);
|
||||||
Guard.NotNull(pattern);
|
Guard.NotNull(pattern);
|
||||||
|
|
||||||
_matchBehaviour = matchBehaviour;
|
MatchBehaviour = matchBehaviour;
|
||||||
_ignoreCase = ignoreCase;
|
IgnoreCase = ignoreCase;
|
||||||
Name = name;
|
Name = name;
|
||||||
Matchers = new IStringMatcher[] { new WildcardMatcher(matchBehaviour, pattern, ignoreCase) };
|
Matchers = new IStringMatcher[] { new WildcardMatcher(matchBehaviour, pattern, ignoreCase) };
|
||||||
}
|
}
|
||||||
@@ -80,11 +87,11 @@ public class RequestMessageHeaderMatcher : IRequestMatcher
|
|||||||
Guard.NotNull(name);
|
Guard.NotNull(name);
|
||||||
Guard.NotNull(matchers);
|
Guard.NotNull(matchers);
|
||||||
|
|
||||||
_matchBehaviour = matchBehaviour;
|
MatchBehaviour = matchBehaviour;
|
||||||
MatchOperator = matchOperator;
|
MatchOperator = matchOperator;
|
||||||
Name = name;
|
Name = name;
|
||||||
Matchers = matchers;
|
Matchers = matchers;
|
||||||
_ignoreCase = ignoreCase;
|
IgnoreCase = ignoreCase;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -108,11 +115,11 @@ public class RequestMessageHeaderMatcher : IRequestMatcher
|
|||||||
{
|
{
|
||||||
if (requestMessage.Headers == null)
|
if (requestMessage.Headers == null)
|
||||||
{
|
{
|
||||||
return MatchBehaviourHelper.Convert(_matchBehaviour, MatchScores.Mismatch);
|
return MatchBehaviourHelper.Convert(MatchBehaviour, MatchScores.Mismatch);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if we want to use IgnoreCase to compare the Header-Name and Header-Value(s)
|
// Check if we want to use IgnoreCase to compare the Header-Name and Header-Value(s)
|
||||||
var headers = !_ignoreCase ? requestMessage.Headers : new Dictionary<string, WireMockList<string>>(requestMessage.Headers, StringComparer.OrdinalIgnoreCase);
|
var headers = !IgnoreCase ? requestMessage.Headers : new Dictionary<string, WireMockList<string>>(requestMessage.Headers, StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
if (Funcs != null)
|
if (Funcs != null)
|
||||||
{
|
{
|
||||||
@@ -124,7 +131,7 @@ public class RequestMessageHeaderMatcher : IRequestMatcher
|
|||||||
{
|
{
|
||||||
if (!headers.ContainsKey(Name))
|
if (!headers.ContainsKey(Name))
|
||||||
{
|
{
|
||||||
return MatchBehaviourHelper.Convert(_matchBehaviour, MatchScores.Mismatch);
|
return MatchBehaviourHelper.Convert(MatchBehaviour, MatchScores.Mismatch);
|
||||||
}
|
}
|
||||||
|
|
||||||
var results = new List<MatchResult>();
|
var results = new List<MatchResult>();
|
||||||
@@ -138,6 +145,6 @@ public class RequestMessageHeaderMatcher : IRequestMatcher
|
|||||||
return MatchResult.From(results, MatchOperator);
|
return MatchResult.From(results, MatchOperator);
|
||||||
}
|
}
|
||||||
|
|
||||||
return MatchBehaviourHelper.Convert(_matchBehaviour, MatchScores.Mismatch);
|
return MatchBehaviourHelper.Convert(MatchBehaviour, MatchScores.Mismatch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -29,7 +29,7 @@ public class RequestMessageParamMatcher : IRequestMatcher
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defines if the key should be matched using case-ignore.
|
/// Defines if the key should be matched using case-ignore.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool? IgnoreCase { get; }
|
public bool IgnoreCase { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The matchers.
|
/// The matchers.
|
||||||
@@ -96,7 +96,7 @@ public class RequestMessageParamMatcher : IRequestMatcher
|
|||||||
return MatchScores.ToScore(requestMessage.Query != null && Funcs.Any(f => f(requestMessage.Query)));
|
return MatchScores.ToScore(requestMessage.Query != null && Funcs.Any(f => f(requestMessage.Query)));
|
||||||
}
|
}
|
||||||
|
|
||||||
var valuesPresentInRequestMessage = ((RequestMessage)requestMessage).GetParameter(Key, IgnoreCase ?? false);
|
var valuesPresentInRequestMessage = ((RequestMessage)requestMessage).GetParameter(Key, IgnoreCase);
|
||||||
if (valuesPresentInRequestMessage == null)
|
if (valuesPresentInRequestMessage == null)
|
||||||
{
|
{
|
||||||
// Key is not present at all, just return Mismatch
|
// Key is not present at all, just return Mismatch
|
||||||
|
|||||||
@@ -259,19 +259,24 @@ internal class MappingConverter
|
|||||||
Headers = headerMatchers.Any() ? headerMatchers.Select(hm => new HeaderModel
|
Headers = headerMatchers.Any() ? headerMatchers.Select(hm => new HeaderModel
|
||||||
{
|
{
|
||||||
Name = hm.Name,
|
Name = hm.Name,
|
||||||
Matchers = _mapper.Map(hm.Matchers)
|
IgnoreCase = hm.IgnoreCase ? true : null,
|
||||||
|
RejectOnMatch = hm.MatchBehaviour == MatchBehaviour.RejectOnMatch ? true : null,
|
||||||
|
Matchers = _mapper.Map(hm.Matchers),
|
||||||
}).ToList() : null,
|
}).ToList() : null,
|
||||||
|
|
||||||
Cookies = cookieMatchers.Any() ? cookieMatchers.Select(cm => new CookieModel
|
Cookies = cookieMatchers.Any() ? cookieMatchers.Select(cm => new CookieModel
|
||||||
{
|
{
|
||||||
Name = cm.Name,
|
Name = cm.Name,
|
||||||
|
IgnoreCase = cm.IgnoreCase ? true : null,
|
||||||
|
RejectOnMatch = cm.MatchBehaviour == MatchBehaviour.RejectOnMatch ? true : null,
|
||||||
Matchers = _mapper.Map(cm.Matchers)
|
Matchers = _mapper.Map(cm.Matchers)
|
||||||
}).ToList() : null,
|
}).ToList() : null,
|
||||||
|
|
||||||
Params = paramsMatchers.Any() ? paramsMatchers.Select(pm => new ParamModel
|
Params = paramsMatchers.Any() ? paramsMatchers.Select(pm => new ParamModel
|
||||||
{
|
{
|
||||||
Name = pm.Key,
|
Name = pm.Key,
|
||||||
IgnoreCase = pm.IgnoreCase == true ? true : null,
|
IgnoreCase = pm.IgnoreCase ? true : null,
|
||||||
|
RejectOnMatch = pm.MatchBehaviour == MatchBehaviour.RejectOnMatch ? true : null,
|
||||||
Matchers = _mapper.Map(pm.Matchers)
|
Matchers = _mapper.Map(pm.Matchers)
|
||||||
}).ToList() : null
|
}).ToList() : null
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -0,0 +1,122 @@
|
|||||||
|
{
|
||||||
|
Guid: Guid_1,
|
||||||
|
UpdatedAt: DateTime_1,
|
||||||
|
Request: {
|
||||||
|
Headers: [
|
||||||
|
{
|
||||||
|
Name: MatchBehaviour.RejectOnMatch,
|
||||||
|
Matchers: [
|
||||||
|
{
|
||||||
|
Name: WildcardMatcher,
|
||||||
|
Pattern: hv-1,
|
||||||
|
IgnoreCase: true,
|
||||||
|
RejectOnMatch: true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
IgnoreCase: true,
|
||||||
|
RejectOnMatch: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: MatchBehaviour.AcceptOnMatch,
|
||||||
|
Matchers: [
|
||||||
|
{
|
||||||
|
Name: WildcardMatcher,
|
||||||
|
Pattern: hv-2,
|
||||||
|
IgnoreCase: true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
IgnoreCase: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: IgnoreCase_false,
|
||||||
|
Matchers: [
|
||||||
|
{
|
||||||
|
Name: WildcardMatcher,
|
||||||
|
Pattern: hv-3,
|
||||||
|
IgnoreCase: false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: IgnoreCase_true,
|
||||||
|
Matchers: [
|
||||||
|
{
|
||||||
|
Name: WildcardMatcher,
|
||||||
|
Pattern: hv-4,
|
||||||
|
IgnoreCase: true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
IgnoreCase: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: ExactMatcher,
|
||||||
|
Matchers: [
|
||||||
|
{
|
||||||
|
Name: ExactMatcher,
|
||||||
|
Pattern: h-exact,
|
||||||
|
IgnoreCase: false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
Cookies: [
|
||||||
|
{
|
||||||
|
Name: MatchBehaviour.RejectOnMatch,
|
||||||
|
Matchers: [
|
||||||
|
{
|
||||||
|
Name: WildcardMatcher,
|
||||||
|
Pattern: cv-1,
|
||||||
|
IgnoreCase: true,
|
||||||
|
RejectOnMatch: true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
IgnoreCase: true,
|
||||||
|
RejectOnMatch: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: MatchBehaviour.AcceptOnMatch,
|
||||||
|
Matchers: [
|
||||||
|
{
|
||||||
|
Name: WildcardMatcher,
|
||||||
|
Pattern: cv-2,
|
||||||
|
IgnoreCase: true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
IgnoreCase: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: IgnoreCase_false,
|
||||||
|
Matchers: [
|
||||||
|
{
|
||||||
|
Name: WildcardMatcher,
|
||||||
|
Pattern: cv-3,
|
||||||
|
IgnoreCase: false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: IgnoreCase_true,
|
||||||
|
Matchers: [
|
||||||
|
{
|
||||||
|
Name: WildcardMatcher,
|
||||||
|
Pattern: cv-4,
|
||||||
|
IgnoreCase: true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
IgnoreCase: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: ExactMatcher,
|
||||||
|
Matchers: [
|
||||||
|
{
|
||||||
|
Name: ExactMatcher,
|
||||||
|
Pattern: c-exact,
|
||||||
|
IgnoreCase: false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
Response: {},
|
||||||
|
UseWebhooksFireAndForget: false
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
{
|
||||||
|
Guid: Guid_1,
|
||||||
|
UpdatedAt: DateTime_1,
|
||||||
|
Request: {
|
||||||
|
Params: [
|
||||||
|
{
|
||||||
|
Name: MatchBehaviour.RejectOnMatch,
|
||||||
|
RejectOnMatch: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: MatchBehaviour.RejectOnMatch|IgnoreCase_false,
|
||||||
|
RejectOnMatch: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: IgnoreCase_false,
|
||||||
|
Matchers: [
|
||||||
|
{
|
||||||
|
Name: ExactMatcher,
|
||||||
|
Pattern: pv-3a,
|
||||||
|
IgnoreCase: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: ExactMatcher,
|
||||||
|
Pattern: pv-3b,
|
||||||
|
IgnoreCase: false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: IgnoreCase_true,
|
||||||
|
IgnoreCase: true,
|
||||||
|
Matchers: [
|
||||||
|
{
|
||||||
|
Name: ExactMatcher,
|
||||||
|
Pattern: pv-3a,
|
||||||
|
IgnoreCase: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: ExactMatcher,
|
||||||
|
Pattern: pv-3b,
|
||||||
|
IgnoreCase: true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: ExactMatcher,
|
||||||
|
Matchers: [
|
||||||
|
{
|
||||||
|
Name: ExactMatcher,
|
||||||
|
Pattern: exact,
|
||||||
|
IgnoreCase: false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
Response: {},
|
||||||
|
UseWebhooksFireAndForget: false
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ using System.Threading;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using VerifyXunit;
|
using VerifyXunit;
|
||||||
|
using WireMock.Matchers;
|
||||||
using WireMock.Models;
|
using WireMock.Models;
|
||||||
using WireMock.RequestBuilders;
|
using WireMock.RequestBuilders;
|
||||||
using WireMock.ResponseBuilders;
|
using WireMock.ResponseBuilders;
|
||||||
@@ -362,6 +363,60 @@ public partial class MappingConverterTests
|
|||||||
return Verifier.Verify(model);
|
return Verifier.Verify(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public Task ToMappingModel_WithHeader_And_Cookie_ReturnsCorrectModel()
|
||||||
|
{
|
||||||
|
// Assign
|
||||||
|
var request = Request.Create()
|
||||||
|
.WithHeader("MatchBehaviour.RejectOnMatch", "hv-1", MatchBehaviour.RejectOnMatch)
|
||||||
|
.WithHeader("MatchBehaviour.AcceptOnMatch", "hv-2", MatchBehaviour.AcceptOnMatch)
|
||||||
|
.WithHeader("IgnoreCase_false", "hv-3", false)
|
||||||
|
.WithHeader("IgnoreCase_true", "hv-4")
|
||||||
|
.WithHeader("ExactMatcher", new ExactMatcher("h-exact"))
|
||||||
|
|
||||||
|
.WithCookie("MatchBehaviour.RejectOnMatch", "cv-1", MatchBehaviour.RejectOnMatch)
|
||||||
|
.WithCookie("MatchBehaviour.AcceptOnMatch", "cv-2", MatchBehaviour.AcceptOnMatch)
|
||||||
|
.WithCookie("IgnoreCase_false", "cv-3", false)
|
||||||
|
.WithCookie("IgnoreCase_true", "cv-4")
|
||||||
|
.WithCookie("ExactMatcher", new ExactMatcher("c-exact"))
|
||||||
|
;
|
||||||
|
var response = Response.Create();
|
||||||
|
var mapping = new Mapping(_guid, _updatedAt, null, null, null, _settings, request, response, 0, null, null, null, null, null, false, null, data: null, probability: null);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var model = _sut.ToMappingModel(mapping);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
model.Should().NotBeNull();
|
||||||
|
|
||||||
|
// Verify
|
||||||
|
return Verifier.Verify(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public Task ToMappingModel_WithParam_ReturnsCorrectModel()
|
||||||
|
{
|
||||||
|
// Assign
|
||||||
|
var request = Request.Create()
|
||||||
|
.WithParam("MatchBehaviour.RejectOnMatch", MatchBehaviour.RejectOnMatch)
|
||||||
|
.WithParam("MatchBehaviour.RejectOnMatch|IgnoreCase_false", false, MatchBehaviour.RejectOnMatch)
|
||||||
|
.WithParam("IgnoreCase_false", false, "pv-3a", "pv-3b")
|
||||||
|
.WithParam("IgnoreCase_true", true, "pv-3a", "pv-3b")
|
||||||
|
.WithParam("ExactMatcher", new ExactMatcher("exact"))
|
||||||
|
;
|
||||||
|
var response = Response.Create();
|
||||||
|
var mapping = new Mapping(_guid, _updatedAt, null, null, null, _settings, request, response, 0, null, null, null, null, null, false, null, data: null, probability: null);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var model = _sut.ToMappingModel(mapping);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
model.Should().NotBeNull();
|
||||||
|
|
||||||
|
// Verify
|
||||||
|
return Verifier.Verify(model);
|
||||||
|
}
|
||||||
|
|
||||||
#if GRAPHQL
|
#if GRAPHQL
|
||||||
[Fact]
|
[Fact]
|
||||||
public Task ToMappingModel_Request_WithBodyAsGraphQLSchema_ReturnsCorrectModel()
|
public Task ToMappingModel_Request_WithBodyAsGraphQLSchema_ReturnsCorrectModel()
|
||||||
|
|||||||
Reference in New Issue
Block a user