GET "/__admin/mappings"

This commit is contained in:
Stef Heyenrath
2017-01-24 22:06:25 +01:00
parent 45aa83ee91
commit 3f84ba8b20
44 changed files with 805 additions and 302 deletions

View File

@@ -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();

View File

@@ -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]

View File

@@ -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"));