mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-31 22:53:27 +02:00
Add more tests for JmesPathMatchers and StringUtils.ParseMatchOperator (#1009)
* Add more tests for JmesPathMatchers and StringUtils.ParseMatchOperator * . * prio
This commit is contained in:
@@ -300,6 +300,31 @@ public class RequestMessageBodyMatcherTests
|
||||
Check.That(score).IsEqualTo(1.0d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RequestMessageBodyMatcher_GetMatchingScore_BodyAsJson_JmesPathMatchers()
|
||||
{
|
||||
// Arrange
|
||||
var body = new BodyData
|
||||
{
|
||||
BodyAsJson = new { requestId = "1", value = "A" },
|
||||
DetectedBodyType = BodyType.Json
|
||||
};
|
||||
|
||||
var requestMessage = new RequestMessage(new UrlDetails("http://localhost"), "GET", "127.0.0.1", body);
|
||||
|
||||
var jmesMatcher1 = new JmesPathMatcher("requestId == '1'");
|
||||
var jmesMatcher2 = new JmesPathMatcher("value == 'A'");
|
||||
|
||||
var bodyMatcher = new RequestMessageBodyMatcher(MatchOperator.And, jmesMatcher1, jmesMatcher2);
|
||||
|
||||
// Act
|
||||
var result = new RequestMatchResult();
|
||||
double score = bodyMatcher.GetMatchingScore(requestMessage, result);
|
||||
|
||||
// Assert
|
||||
score.Should().Be(MatchScores.Perfect);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(null, 0.0)]
|
||||
[InlineData(new byte[0], 0.0)]
|
||||
|
||||
Reference in New Issue
Block a user