Skip to content

Commit

Permalink
JsonPartialMatcher - match guid and string. Add Regex with Guid test (W…
Browse files Browse the repository at this point in the history
  • Loading branch information
timurnes committed Jul 19, 2023
1 parent 21d0426 commit 26c2831
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/WireMock.Net.Tests/Matchers/JsonPartialMatcherTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,27 @@ public void JsonPartialMatcher_IsMatch_WithRegexFalse()
Assert.Equal(0.0, match);
}

[Fact]
public void JsonPartialMatcher_IsMatch_GuidAsString_UsingRegex()
{
var guid = new Guid("1111238e-b775-44a9-a263-95e570135c94");
var matcher = new JsonPartialMatcher(new {
Id = 1,
Name = "^1111[a-fA-F0-9]{4}(-[a-fA-F0-9]{4}){3}-[a-fA-F0-9]{12}$"
}, false, false, true);

// Act
var jObject = new JObject
{
{ "Id", new JValue(1) },
{ "Name", new JValue(guid) }
};
double match = matcher.IsMatch(jObject);

// Assert
Assert.Equal(1.0, match);
}

[Fact]
public void JsonPartialMatcher_IsMatch_WithIgnoreCaseTrue_JObject()
{
Expand Down

0 comments on commit 26c2831

Please sign in to comment.