public void ReasonIsCorrectlyInitialized(string reason, ApiController controller) { // Exercise system var result = new JSendBadRequestResult(reason, controller); // Verify outcome result.Reason.Should().Be(reason); }
public async Task SetsContentTypeHeader(JSendBadRequestResult result) { // Exercise system var message = await result.ExecuteAsync(new CancellationToken()); // Verify outcome message.Content.Headers.ContentType.MediaType.Should().Be("application/json"); }
public async Task SetsStatusCode(JSendBadRequestResult result) { // Exercise system var message = await result.ExecuteAsync(new CancellationToken()); // Verify outcome message.StatusCode.Should().Be(result.StatusCode); }
public void ResponseIsCorrectlyInitialized(string reason, ApiController controller) { // Fixture setup var expectedResponse = new FailResponse(reason); // Exercise system var result = new JSendBadRequestResult(reason, controller); // Verify outcome result.Response.ShouldBeEquivalentTo(expectedResponse); }
public async Task ResponseIsSerializedIntoBody(JSendBadRequestResult result) { // Fixture setup var serializedResponse = JsonConvert.SerializeObject(result.Response); // Exercise system var httpResponse = await result.ExecuteAsync(new CancellationToken()); // Verify outcome var content = await httpResponse.Content.ReadAsStringAsync(); content.Should().Be(serializedResponse); }
public async Task ResponseIsSerializedIntoBody(JSendBadRequestResult result) { // Fixture setup var serializedResponse = JsonConvert.SerializeObject(result.Response); // Exercise system var httpResponseMessage = await result.ExecuteAsync(new CancellationToken()); // Verify outcome var content = await httpResponseMessage.Content.ReadAsStringAsync(); content.Should().Be(serializedResponse); }
public void StatusCodeIs400(JSendBadRequestResult result) { // Exercise system and verify outcome result.StatusCode.Should().Be(HttpStatusCode.BadRequest); }
public void IsHttpActionResult(JSendBadRequestResult result) { // Exercise system and verify outcome result.Should().BeAssignableTo<IHttpActionResult>(); }
public void IsHttpActionResult(JSendBadRequestResult result) { // Exercise system and verify outcome result.Should().BeAssignableTo <IHttpActionResult>(); }