fixing formatting

This commit is contained in:
Brian Engen 2016-04-16 20:41:31 -05:00
parent c6b2b77d8a
commit 42bb28e284
2 changed files with 20 additions and 20 deletions

View File

@ -57,15 +57,15 @@ namespace Flurl.Http.Testing
return With(c => MatchesPattern(c.RequestBody, bodyPattern));
}
/// <summary>
/// Asserts whether calls were made containing given request body.
/// </summary>
/// <param name="body"></param>
/// <returns></returns>
public HttpCallAssertion WithRequestBodyJson(object body){
var serializedBody = FlurlHttp.GlobalSettings.JsonSerializer.Serialize(body);
return With(c => MatchesPattern(c.RequestBody, serializedBody));
}
/// <summary>
/// Asserts whether calls were made containing given request body.
/// </summary>
/// <param name="body"></param>
/// <returns></returns>
public HttpCallAssertion WithRequestBodyJson(object body) {
var serializedBody = FlurlHttp.GlobalSettings.JsonSerializer.Serialize(body);
return With(c => MatchesPattern(c.RequestBody, serializedBody));
}
/// <summary>
/// Asserts whether calls were made with given HTTP verb.

View File

@ -18,17 +18,17 @@ namespace Flurl.Test.Http
.Times(1);
}
[Test]
public async Task can_post_object_as_json(){
var expectedEndpoint = "http://some-api.com";
var expectedBody = new {a = 1, b = 2};
await expectedEndpoint.PostJsonAsync(expectedBody);
HttpTest.ShouldHaveCalled(expectedEndpoint)
.WithVerb(HttpMethod.Post)
.WithContentType("application/json")
.WithRequestBodyJson(expectedBody)
.Times(1);
}
[Test]
public async Task can_post_object_as_json() {
var expectedEndpoint = "http://some-api.com";
var expectedBody = new {a = 1, b = 2};
await expectedEndpoint.PostJsonAsync(expectedBody);
HttpTest.ShouldHaveCalled(expectedEndpoint)
.WithVerb(HttpMethod.Post)
.WithContentType("application/json")
.WithRequestBodyJson(expectedBody)
.Times(1);
}
[Test]
public async Task can_post_url_encoded() {