From beabba40649d7c5ec207b82a37864ff853f842b3 Mon Sep 17 00:00:00 2001 From: Stef Heyenrath Date: Wed, 23 Apr 2025 07:47:07 +0200 Subject: [PATCH] Add extra unit tests for PR #1278 --- .../Matchers/JmesPathMatcherTests.cs | 16 ++++++++++++++-- .../Matchers/JsonPathMatcherTests.cs | 16 ++++++++++++++-- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/test/WireMock.Net.Tests/Matchers/JmesPathMatcherTests.cs b/test/WireMock.Net.Tests/Matchers/JmesPathMatcherTests.cs index 8dbcbc4f..01d6e522 100644 --- a/test/WireMock.Net.Tests/Matchers/JmesPathMatcherTests.cs +++ b/test/WireMock.Net.Tests/Matchers/JmesPathMatcherTests.cs @@ -55,11 +55,23 @@ public class JmesPathMatcherTests public void JmesPathMatcher_IsMatch_NullString() { // Assign - string? s = null; var matcher = new JmesPathMatcher(""); // Act - double match = matcher.IsMatch(s).Score; + double match = matcher.IsMatch(null).Score; + + // Assert + Check.That(match).IsEqualTo(0); + } + + [Fact] + public void JmesPathMatcher_IsMatch_EmptyString() + { + // Assign + var matcher = new JmesPathMatcher(""); + + // Act + double match = matcher.IsMatch(string.Empty).Score; // Assert Check.That(match).IsEqualTo(0); diff --git a/test/WireMock.Net.Tests/Matchers/JsonPathMatcherTests.cs b/test/WireMock.Net.Tests/Matchers/JsonPathMatcherTests.cs index 3612cabc..53aa8ecb 100644 --- a/test/WireMock.Net.Tests/Matchers/JsonPathMatcherTests.cs +++ b/test/WireMock.Net.Tests/Matchers/JsonPathMatcherTests.cs @@ -55,11 +55,23 @@ public class JsonPathMatcherTests public void JsonPathMatcher_IsMatch_NullString() { // Arrange - string? s = null; var matcher = new JsonPathMatcher(""); // Act - double match = matcher.IsMatch(s).Score; + double match = matcher.IsMatch(null).Score; + + // Assert + Check.That(match).IsEqualTo(0); + } + + [Fact] + public void JsonPathMatcher_IsMatch_EmptyString() + { + // Arrange + var matcher = new JsonPathMatcher(""); + + // Act + double match = matcher.IsMatch(string.Empty).Score; // Assert Check.That(match).IsEqualTo(0);