Rename classes

This commit is contained in:
Stef Heyenrath
2017-01-18 07:42:05 +01:00
parent c0872995b0
commit 8f02e99a00
23 changed files with 142 additions and 147 deletions

View File

@@ -43,10 +43,10 @@ namespace WireMock.Net.Tests
_server = FluentMockServer.Start();
_server
.Given(RequestBuilder
.Given(Request
.WithUrl("/foo")
.UsingGet())
.RespondWith(ResponseBuilder
.RespondWith(Response
.WithStatusCode(200)
.WithBody(@"{ msg: ""Hello world!""}"));
@@ -100,7 +100,7 @@ namespace WireMock.Net.Tests
await new HttpClient().GetAsync("http://localhost:" + _server.Port + "/bar");
// then
var result = _server.SearchLogsFor(RequestBuilder.WithUrl("/b.*"));
var result = _server.SearchLogsFor(Request.WithUrl("/b.*"));
Check.That(result).HasSize(1);
var requestLogged = result.First();
Check.That(requestLogged.Url).IsEqualTo("/bar");
@@ -127,10 +127,10 @@ namespace WireMock.Net.Tests
_server = FluentMockServer.Start();
_server
.Given(RequestBuilder
.Given(Request
.WithUrl("/foo")
.UsingGet())
.RespondWith(ResponseBuilder
.RespondWith(Response
.WithStatusCode(200)
.WithBody(@"{ msg: ""Hello world!""}"));
@@ -149,17 +149,17 @@ namespace WireMock.Net.Tests
_server = FluentMockServer.Start();
_server
.Given(RequestBuilder
.Given(Request
.WithUrl("/foo")
.UsingGet())
.RespondWith(ResponseBuilder
.RespondWith(Response
.WithStatusCode(307)
.WithHeader("Location", "/bar"));
_server
.Given(RequestBuilder
.Given(Request
.WithUrl("/bar")
.UsingGet())
.RespondWith(ResponseBuilder
.RespondWith(Response
.WithStatusCode(200)
.WithBody("REDIRECT SUCCESSFUL"));
@@ -178,9 +178,9 @@ namespace WireMock.Net.Tests
_server = FluentMockServer.Start();
_server
.Given(RequestBuilder
.Given(Request
.WithUrl("/*"))
.RespondWith(ResponseBuilder
.RespondWith(Response
.WithStatusCode(200)
.WithBody(@"{ msg: ""Hello world!""}")
.AfterDelay(TimeSpan.FromMilliseconds(2000)));
@@ -202,9 +202,9 @@ namespace WireMock.Net.Tests
_server = FluentMockServer.Start();
_server.AddRequestProcessingDelay(TimeSpan.FromMilliseconds(2000));
_server
.Given(RequestBuilder
.Given(Request
.WithUrl("/*"))
.RespondWith(ResponseBuilder
.RespondWith(Response
.WithStatusCode(200)
.WithBody(@"{ msg: ""Hello world!""}"));

View File

@@ -49,8 +49,8 @@ namespace WireMock.Net.Tests
await client.GetAsync(MapperServer.UrlPrefix + "toto");
// then
Check.That(MapperServer.LastRequest).IsNotNull();
Check.That(MapperServer.LastRequest.Url).IsEqualTo("/toto");
Check.That(MapperServer.LastRequestMessage).IsNotNull();
Check.That(MapperServer.LastRequestMessage.Url).IsEqualTo("/toto");
}
[Test]
@@ -63,8 +63,8 @@ namespace WireMock.Net.Tests
await client.PutAsync(MapperServer.UrlPrefix, new StringContent("Hello!"));
// then
Check.That(MapperServer.LastRequest).IsNotNull();
Check.That(MapperServer.LastRequest.Verb).IsEqualTo("put");
Check.That(MapperServer.LastRequestMessage).IsNotNull();
Check.That(MapperServer.LastRequestMessage.Verb).IsEqualTo("put");
}
[Test]
@@ -77,8 +77,8 @@ namespace WireMock.Net.Tests
await client.PutAsync(MapperServer.UrlPrefix, new StringContent("Hello!"));
// then
Check.That(MapperServer.LastRequest).IsNotNull();
Check.That(MapperServer.LastRequest.Body).IsEqualTo("Hello!");
Check.That(MapperServer.LastRequestMessage).IsNotNull();
Check.That(MapperServer.LastRequestMessage.Body).IsEqualTo("Hello!");
}
[Test]
@@ -92,9 +92,9 @@ namespace WireMock.Net.Tests
await client.GetAsync(MapperServer.UrlPrefix);
// then
Check.That(MapperServer.LastRequest).IsNotNull();
Check.That(MapperServer.LastRequest.Headers).Not.IsNullOrEmpty();
Check.That(MapperServer.LastRequest.Headers.Contains(new KeyValuePair<string, string>("X-Alex", "1706"))).IsTrue();
Check.That(MapperServer.LastRequestMessage).IsNotNull();
Check.That(MapperServer.LastRequestMessage.Headers).Not.IsNullOrEmpty();
Check.That(MapperServer.LastRequestMessage.Headers.Contains(new KeyValuePair<string, string>("X-Alex", "1706"))).IsTrue();
}
[Test]
@@ -107,9 +107,9 @@ namespace WireMock.Net.Tests
await client.GetAsync(MapperServer.UrlPrefix + "index.html?id=toto");
// then
Check.That(MapperServer.LastRequest).IsNotNull();
Check.That(MapperServer.LastRequest.Path).EndsWith("/index.html");
Check.That(MapperServer.LastRequest.GetParameter("id")).HasSize(1);
Check.That(MapperServer.LastRequestMessage).IsNotNull();
Check.That(MapperServer.LastRequestMessage.Path).EndsWith("/index.html");
Check.That(MapperServer.LastRequestMessage.GetParameter("id")).HasSize(1);
}
[TearDown]
@@ -120,22 +120,22 @@ namespace WireMock.Net.Tests
private class MapperServer : TinyHttpServer
{
private static volatile Request _lastRequest;
private static volatile RequestMessage _lastRequestMessage;
private MapperServer(string urlPrefix, Action<HttpListenerContext> httpHandler) : base(urlPrefix, httpHandler)
{
}
public static Request LastRequest
public static RequestMessage LastRequestMessage
{
get
{
return _lastRequest;
return _lastRequestMessage;
}
private set
{
_lastRequest = value;
_lastRequestMessage = value;
}
}
@@ -149,7 +149,7 @@ namespace WireMock.Net.Tests
UrlPrefix,
context =>
{
LastRequest = new HttpListenerRequestMapper().Map(context.Request);
LastRequestMessage = new HttpListenerRequestMapper().Map(context.Request);
context.Response.Close();
});
((TinyHttpServer)server).Start();
@@ -159,7 +159,7 @@ namespace WireMock.Net.Tests
public new void Stop()
{
base.Stop();
LastRequest = null;
LastRequestMessage = null;
}
}
}

View File

@@ -37,7 +37,7 @@ namespace WireMock.Net.Tests
public void Should_map_status_code_from_original_response()
{
// given
var response = new Response { StatusCode = 404 };
var response = new ResponseMessage { StatusCode = 404 };
var httpListenerResponse = CreateHttpListenerResponse();
// when
@@ -51,7 +51,7 @@ namespace WireMock.Net.Tests
public void Should_map_headers_from_original_response()
{
// given
var response = new Response();
var response = new ResponseMessage();
response.AddHeader("cache-control", "no-cache");
var httpListenerResponse = CreateHttpListenerResponse();
@@ -68,7 +68,7 @@ namespace WireMock.Net.Tests
public void Should_map_body_from_original_response()
{
// given
var response = new Response();
var response = new ResponseMessage();
response.Body = "Hello !!!";
var httpListenerResponse = CreateHttpListenerResponse();

View File

@@ -21,7 +21,7 @@ namespace WireMock.Net.Tests
public void Should_handle_empty_query()
{
// given
var request = new Request("/foo", string.Empty, "blabla", "whatever", new Dictionary<string, string>());
var request = new RequestMessage("/foo", string.Empty, "blabla", "whatever", new Dictionary<string, string>());
// then
Check.That(request.GetParameter("foo")).IsEmpty();
@@ -31,7 +31,7 @@ namespace WireMock.Net.Tests
public void Should_parse_query_params()
{
// given
var request = new Request("/foo", "foo=bar&multi=1&multi=2", "blabla", "whatever", new Dictionary<string, string>());
var request = new RequestMessage("/foo", "foo=bar&multi=1&multi=2", "blabla", "whatever", new Dictionary<string, string>());
// then
Check.That(request.GetParameter("foo")).Contains("bar");

View File

@@ -22,10 +22,10 @@ namespace WireMock.Net.Tests
public void Should_specify_requests_matching_given_url()
{
// given
var spec = RequestBuilder.WithUrl("/foo");
var spec = Request.WithUrl("/foo");
// when
var request = new Request("/foo", string.Empty, "blabla", "whatever", new Dictionary<string, string>());
var request = new RequestMessage("/foo", string.Empty, "blabla", "whatever", new Dictionary<string, string>());
// then
Check.That(spec.IsSatisfiedBy(request)).IsTrue();
@@ -35,10 +35,10 @@ namespace WireMock.Net.Tests
public void Should_specify_requests_matching_given_url_prefix()
{
// given
var spec = RequestBuilder.WithUrl("/foo*");
var spec = Request.WithUrl("/foo*");
// when
var request = new Request("/foo/bar", string.Empty, "blabla", "whatever", new Dictionary<string, string>());
var request = new RequestMessage("/foo/bar", string.Empty, "blabla", "whatever", new Dictionary<string, string>());
// then
Check.That(spec.IsSatisfiedBy(request)).IsTrue();
@@ -48,10 +48,10 @@ namespace WireMock.Net.Tests
public void Should_exclude_requests_not_matching_given_url()
{
// given
var spec = RequestBuilder.WithUrl("/foo");
var spec = Request.WithUrl("/foo");
// when
var request = new Request("/bar", string.Empty, "blabla", "whatever", new Dictionary<string, string>());
var request = new RequestMessage("/bar", string.Empty, "blabla", "whatever", new Dictionary<string, string>());
// then
Check.That(spec.IsSatisfiedBy(request)).IsFalse();
@@ -61,10 +61,10 @@ namespace WireMock.Net.Tests
public void Should_specify_requests_matching_given_path()
{
// given
var spec = RequestBuilder.WithPath("/foo");
var spec = Request.WithPath("/foo");
// when
var request = new Request("/foo", "?param=1", "blabla", "whatever", new Dictionary<string, string>());
var request = new RequestMessage("/foo", "?param=1", "blabla", "whatever", new Dictionary<string, string>());
// then
Check.That(spec.IsSatisfiedBy(request)).IsTrue();
@@ -74,10 +74,10 @@ namespace WireMock.Net.Tests
public void Should_specify_requests_matching_given_url_and_method()
{
// given
var spec = RequestBuilder.WithUrl("/foo").UsingPut();
var spec = Request.WithUrl("/foo").UsingPut();
// when
var request = new Request("/foo", string.Empty, "PUT", "whatever", new Dictionary<string, string>());
var request = new RequestMessage("/foo", string.Empty, "PUT", "whatever", new Dictionary<string, string>());
// then
Check.That(spec.IsSatisfiedBy(request)).IsTrue();
@@ -87,10 +87,10 @@ namespace WireMock.Net.Tests
public void Should_exclude_requests_matching_given_url_but_not_http_method()
{
// given
var spec = RequestBuilder.WithUrl("/foo").UsingPut();
var spec = Request.WithUrl("/foo").UsingPut();
// when
var request = new Request("/foo", string.Empty, "POST", "whatever", new Dictionary<string, string>());
var request = new RequestMessage("/foo", string.Empty, "POST", "whatever", new Dictionary<string, string>());
// then
Check.That(spec.IsSatisfiedBy(request)).IsFalse();
@@ -100,10 +100,10 @@ namespace WireMock.Net.Tests
public void Should_exclude_requests_matching_given_http_method_but_not_url()
{
// given
var spec = RequestBuilder.WithUrl("/bar").UsingPut();
var spec = Request.WithUrl("/bar").UsingPut();
// when
var request = new Request("/foo", string.Empty, "PUT", "whatever", new Dictionary<string, string>());
var request = new RequestMessage("/foo", string.Empty, "PUT", "whatever", new Dictionary<string, string>());
// then
Check.That(spec.IsSatisfiedBy(request)).IsFalse();
@@ -113,10 +113,10 @@ namespace WireMock.Net.Tests
public void Should_specify_requests_matching_given_url_and_headers()
{
// given
var spec = RequestBuilder.WithUrl("/foo").UsingAnyVerb().WithHeader("X-toto", "tata");
var spec = Request.WithUrl("/foo").UsingAnyVerb().WithHeader("X-toto", "tata");
// when
var request = new Request("/foo", string.Empty, "PUT", "whatever", new Dictionary<string, string> { { "X-toto", "tata" } });
var request = new RequestMessage("/foo", string.Empty, "PUT", "whatever", new Dictionary<string, string> { { "X-toto", "tata" } });
// then
Check.That(spec.IsSatisfiedBy(request)).IsTrue();
@@ -126,10 +126,10 @@ namespace WireMock.Net.Tests
public void Should_exclude_requests_not_matching_given_headers()
{
// given
var spec = RequestBuilder.WithUrl("/foo").UsingAnyVerb().WithHeader("X-toto", "tatata");
var spec = Request.WithUrl("/foo").UsingAnyVerb().WithHeader("X-toto", "tatata");
// when
var request = new Request("/foo", string.Empty, "PUT", "whatever", new Dictionary<string, string> { { "X-toto", "tata" } });
var request = new RequestMessage("/foo", string.Empty, "PUT", "whatever", new Dictionary<string, string> { { "X-toto", "tata" } });
// then
Check.That(spec.IsSatisfiedBy(request)).IsFalse();
@@ -139,10 +139,10 @@ namespace WireMock.Net.Tests
public void Should_exclude_requests_not_matching_given_headers_ignorecase()
{
// given
var spec = RequestBuilder.WithUrl("/foo").UsingAnyVerb().WithHeader("X-toto", "abc", false);
var spec = Request.WithUrl("/foo").UsingAnyVerb().WithHeader("X-toto", "abc", false);
// when
var request = new Request("/foo", string.Empty, "PUT", "whatever", new Dictionary<string, string> { { "X-toto", "ABC" } });
var request = new RequestMessage("/foo", string.Empty, "PUT", "whatever", new Dictionary<string, string> { { "X-toto", "ABC" } });
// then
Check.That(spec.IsSatisfiedBy(request)).IsFalse();
@@ -152,10 +152,10 @@ namespace WireMock.Net.Tests
public void Should_specify_requests_matching_given_header_prefix()
{
// given
var spec = RequestBuilder.WithUrl("/foo").UsingAnyVerb().WithHeader("X-toto", "tata*");
var spec = Request.WithUrl("/foo").UsingAnyVerb().WithHeader("X-toto", "tata*");
// when
var request = new Request("/foo", string.Empty, "PUT", "whatever", new Dictionary<string, string> { { "X-toto", "TaTaTa" } });
var request = new RequestMessage("/foo", string.Empty, "PUT", "whatever", new Dictionary<string, string> { { "X-toto", "TaTaTa" } });
// then
Check.That(spec.IsSatisfiedBy(request)).IsTrue();
@@ -165,10 +165,10 @@ namespace WireMock.Net.Tests
public void Should_specify_requests_matching_given_body()
{
// given
var spec = RequestBuilder.WithUrl("/foo").UsingAnyVerb().WithBody(".*Hello world!.*");
var spec = Request.WithUrl("/foo").UsingAnyVerb().WithBody(".*Hello world!.*");
// when
var request = new Request("/foo", string.Empty, "PUT", "Hello world!", new Dictionary<string, string> { { "X-toto", "tatata" } });
var request = new RequestMessage("/foo", string.Empty, "PUT", "Hello world!", new Dictionary<string, string> { { "X-toto", "tatata" } });
// then
Check.That(spec.IsSatisfiedBy(request)).IsTrue();
@@ -178,10 +178,10 @@ namespace WireMock.Net.Tests
public void Should_specify_requests_matching_given_body_as_wildcard()
{
// given
var spec = RequestBuilder.WithUrl("/foo").UsingAnyVerb().WithBody("H.*o");
var spec = Request.WithUrl("/foo").UsingAnyVerb().WithBody("H.*o");
// when
var request = new Request("/foo", string.Empty, "PUT", "Hello world!", new Dictionary<string, string> { { "X-toto", "tatata" } });
var request = new RequestMessage("/foo", string.Empty, "PUT", "Hello world!", new Dictionary<string, string> { { "X-toto", "tatata" } });
// then
Check.That(spec.IsSatisfiedBy(request)).IsTrue();
@@ -191,10 +191,10 @@ namespace WireMock.Net.Tests
public void Should_exclude_requests_not_matching_given_body()
{
// given
var spec = RequestBuilder.WithUrl("/foo").UsingAnyVerb().WithBody(" Hello world! ");
var spec = Request.WithUrl("/foo").UsingAnyVerb().WithBody(" Hello world! ");
// when
var request = new Request("/foo", string.Empty, "PUT", "XXXXXXXXXXX", new Dictionary<string, string> { { "X-toto", "tatata" } });
var request = new RequestMessage("/foo", string.Empty, "PUT", "XXXXXXXXXXX", new Dictionary<string, string> { { "X-toto", "tatata" } });
// then
Check.That(spec.IsSatisfiedBy(request)).IsFalse();
@@ -204,10 +204,10 @@ namespace WireMock.Net.Tests
public void Should_specify_requests_matching_given_params()
{
// given
var spec = RequestBuilder.WithPath("/foo").WithParam("bar", "1", "2");
var spec = Request.WithPath("/foo").WithParam("bar", "1", "2");
// when
var request = new Request("/foo", "bar=1&bar=2", "Get", "Hello world!", new Dictionary<string, string>());
var request = new RequestMessage("/foo", "bar=1&bar=2", "Get", "Hello world!", new Dictionary<string, string>());
// then
Check.That(spec.IsSatisfiedBy(request)).IsTrue();
@@ -217,10 +217,10 @@ namespace WireMock.Net.Tests
public void Should_exclude_requests_not_matching_given_params()
{
// given
var spec = RequestBuilder.WithPath("/foo").WithParam("bar", "1");
var spec = Request.WithPath("/foo").WithParam("bar", "1");
// when
var request = new Request("/foo", string.Empty, "PUT", "XXXXXXXXXXX", new Dictionary<string, string>());
var request = new RequestMessage("/foo", string.Empty, "PUT", "XXXXXXXXXXX", new Dictionary<string, string>());
// then
Check.That(spec.IsSatisfiedBy(request)).IsFalse();