mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-10 18:56:50 +02:00
Add extra unit tests
This commit is contained in:
30
test/WireMock.Net.Tests/RequestWithUrlTests.cs
Normal file
30
test/WireMock.Net.Tests/RequestWithUrlTests.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using FluentAssertions;
|
||||
using WireMock.Matchers;
|
||||
using Xunit;
|
||||
using WireMock.RequestBuilders;
|
||||
using WireMock.Matchers.Request;
|
||||
using WireMock.Models;
|
||||
using WireMock.Util;
|
||||
|
||||
namespace WireMock.Net.Tests
|
||||
{
|
||||
public class RequestWithUrlTests
|
||||
{
|
||||
private const string ClientIp = "::1";
|
||||
|
||||
[Fact]
|
||||
public void Request_WithUrl_Regex()
|
||||
{
|
||||
// Assign
|
||||
var spec = Request.Create().WithUrl(new RegexMatcher("(some\\/service\\/v1\\/name)([?]{1})(param.source=SYSTEM){1}([&]{1})(param.id=123457890){1}$")).UsingAnyMethod();
|
||||
|
||||
// Act
|
||||
var body = new BodyData();
|
||||
var request = new RequestMessage(new UrlDetails("https://localhost/some/service/v1/name?param.source=SYSTEM¶m.id=123457890"), "POST", ClientIp, body);
|
||||
|
||||
// Assert
|
||||
var requestMatchResult = new RequestMatchResult();
|
||||
spec.GetMatchingScore(request, requestMatchResult).Should().Be(1.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user