mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-23 18:01:47 +01:00
GET "/__admin/mappings"
This commit is contained in:
@@ -30,7 +30,7 @@ namespace WireMock.Net.Tests
|
||||
_server.Given(Request.Create().WithUrl("/foo2").UsingGet())
|
||||
.RespondWith(Response.Create().WithStatusCode(202).WithBody("2"));
|
||||
|
||||
var routes = _server.Routes;
|
||||
var routes = _server.Mappings;
|
||||
|
||||
Check.That(routes).HasSize(2);
|
||||
Check.That(routes.First().RequestMatcher).IsNotNull();
|
||||
|
||||
@@ -12,12 +12,10 @@ namespace WireMock.Net.Tests
|
||||
public void Should_handle_empty_query()
|
||||
{
|
||||
// given
|
||||
string bodyAsString = "whatever";
|
||||
byte[] body = Encoding.UTF8.GetBytes(bodyAsString);
|
||||
var request = new RequestMessage(new Uri("http://localhost/foo"), "POST", body, bodyAsString);
|
||||
var request = new RequestMessage(new Uri("http://localhost/foo"), "POST");
|
||||
|
||||
// then
|
||||
Check.That(request.GetParameter("foo")).IsEmpty();
|
||||
Check.That(request.GetParameter("not_there")).IsNull();
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -40,6 +40,19 @@ namespace WireMock.Net.Tests
|
||||
Check.That(requestBuilder.IsMatch(request2)).IsTrue();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Should_specify_requests_matching_given_urlFuncs()
|
||||
{
|
||||
// given
|
||||
var spec = Request.Create().WithUrl(url => url.EndsWith("/foo"));
|
||||
|
||||
// when
|
||||
var request = new RequestMessage(new Uri("http://localhost/foo"), "blabla");
|
||||
|
||||
// then
|
||||
Check.That(spec.IsMatch(request)).IsTrue();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Should_specify_requests_matching_given_url_prefix()
|
||||
{
|
||||
@@ -394,7 +407,7 @@ namespace WireMock.Net.Tests
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Should_specify_requests_matching_given_params()
|
||||
public void Should_specify_requests_matching_given_param()
|
||||
{
|
||||
// given
|
||||
var spec = Request.Create().WithPath("/foo").WithParam("bar", "1", "2");
|
||||
@@ -409,7 +422,20 @@ namespace WireMock.Net.Tests
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Should_specify_requests_matching_given_params_func()
|
||||
public void Should_specify_requests_matching_given_paramNoValue()
|
||||
{
|
||||
// given
|
||||
var spec = Request.Create().WithPath("/foo").WithParam("bar");
|
||||
|
||||
// when
|
||||
var request = new RequestMessage(new Uri("http://localhost/foo?bar"), "PUT");
|
||||
|
||||
// then
|
||||
Check.That(spec.IsMatch(request)).IsTrue();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Should_specify_requests_matching_given_param_func()
|
||||
{
|
||||
// given
|
||||
var spec = Request.Create().WithPath("/foo").UsingAnyVerb().WithParam(p => p.ContainsKey("bar"));
|
||||
|
||||
Reference in New Issue
Block a user