public async Task SetsContentTypeHeader([InvalidModelState] JSendInvalidModelStateResult 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([InvalidModelState] JSendInvalidModelStateResult result)
        {
            // Exercise system
            var message = await result.ExecuteAsync(new CancellationToken());

            // Verify outcome
            message.StatusCode.Should().Be(result.StatusCode);
        }
 public void RequestIsCorrectlyInitializedUsingController(
     [InvalidModelState] ModelStateDictionary modelState, ApiController controller)
 {
     // Exercise system
     var result = new JSendInvalidModelStateResult(modelState, controller);
     // Verify outcome
     result.Request.Should().Be(controller.Request);
 }
        public void RequestIsCorrectlyInitializedUsingController(
            [InvalidModelState] ModelStateDictionary modelState, ApiController controller)
        {
            // Exercise system
            var result = new JSendInvalidModelStateResult(modelState, controller);

            // Verify outcome
            result.Request.Should().Be(controller.Request);
        }
        public async Task ResponseIsSerializedIntoBody([InvalidModelState] JSendInvalidModelStateResult 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 void ResponseIsFail([InvalidModelState] JSendInvalidModelStateResult result)
 {
     // Exercise system and verify outcome
     result.Response.Should().BeAssignableTo <FailResponse>();
 }
 public void ResponseDataMatchesModelState([InvalidModelState] JSendInvalidModelStateResult result)
 {
     // Exercise system and verify outcome
     result.Response.Data.ShouldBeEquivalentTo(result.ModelState);
 }
 public void StatusCodeIs400([InvalidModelState] JSendInvalidModelStateResult result)
 {
     // Exercise system and verify outcome
     result.StatusCode.Should().Be(HttpStatusCode.BadRequest);
 }
 public void IsHttpActionResult([InvalidModelState] JSendInvalidModelStateResult result)
 {
     // Exercise system and verify outcome
     result.Should().BeAssignableTo <IHttpActionResult>();
 }