This commit is contained in:
Stef Heyenrath
2017-01-18 08:19:57 +01:00
parent 8f02e99a00
commit 9d1fd8fd51
5 changed files with 89 additions and 2 deletions

View File

@@ -19,7 +19,7 @@ namespace WireMock.Net.Tests.Http
public class TinyHttpServerTests
{
[Test]
public void Should_Call_Handler_on_Request()
public void Should_call_handler_on_request()
{
// given
var port = Ports.FindFreeTcpPort();

View File

@@ -71,7 +71,7 @@ namespace WireMock.Net.Tests
}
[Test]
public void Should_specify_requests_matching_given_url_and_method()
public void Should_specify_requests_matching_given_url_and_method_put()
{
// given
var spec = Request.WithUrl("/foo").UsingPut();
@@ -83,6 +83,58 @@ namespace WireMock.Net.Tests
Check.That(spec.IsSatisfiedBy(request)).IsTrue();
}
[Test]
public void Should_specify_requests_matching_given_url_and_method_post()
{
// given
var spec = Request.WithUrl("/foo").UsingPost();
// when
var request = new RequestMessage("/foo", string.Empty, "POST", "whatever", new Dictionary<string, string>());
// then
Check.That(spec.IsSatisfiedBy(request)).IsTrue();
}
[Test]
public void Should_specify_requests_matching_given_url_and_method_get()
{
// given
var spec = Request.WithUrl("/foo").UsingGet();
// when
var request = new RequestMessage("/foo", string.Empty, "GET", "whatever", new Dictionary<string, string>());
// then
Check.That(spec.IsSatisfiedBy(request)).IsTrue();
}
[Test]
public void Should_specify_requests_matching_given_url_and_method_delete()
{
// given
var spec = Request.WithUrl("/foo").UsingDelete();
// when
var request = new RequestMessage("/foo", string.Empty, "DELETE", "whatever", new Dictionary<string, string>());
// then
Check.That(spec.IsSatisfiedBy(request)).IsTrue();
}
[Test]
public void Should_specify_requests_matching_given_url_and_method_head()
{
// given
var spec = Request.WithUrl("/foo").UsingHead();
// when
var request = new RequestMessage("/foo", string.Empty, "HEAD", "whatever", new Dictionary<string, string>());
// then
Check.That(spec.IsSatisfiedBy(request)).IsTrue();
}
[Test]
public void Should_exclude_requests_matching_given_url_but_not_http_method()
{
@@ -227,3 +279,4 @@ namespace WireMock.Net.Tests
}
}
}