public void RequestIsCorrectlyInitialized(HttpRequestMessage request)
 {
     // Exercise system
     var result = new JSendOkResult(request);
     // Verify outcome
     result.Request.Should().Be(request);
 }
 public void RequestIsCorrectlyInitializedUsingController(ApiController controller)
 {
     // Exercise system
     var result = new JSendOkResult(controller);
     // Verify outcome
     result.Request.Should().Be(controller.Request);
 }
 public void ResponseIsCorrectlyInitialized(ApiController controller)
 {
     // Fixture setup
     var expectedResponse = new SuccessResponse();
     // Exercise system
     var result = new JSendOkResult(controller);
     // Verify outcome
     result.Response.ShouldBeEquivalentTo(expectedResponse);
 }
 public async Task ResponseIsSerializedIntoBody(JSendOkResult 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 HttpResponseMessage Convert(HttpControllerContext controllerContext, object actionResult)
        {
            if (controllerContext == null)
                throw new ArgumentNullException(nameof(controllerContext));
            
            var request = controllerContext.Request;

            var result = new JSendOkResult(request);

            return result.ExecuteAsync(CancellationToken.None).Result;
        }
 public async Task SetsContentTypeHeader(JSendOkResult 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(JSendOkResult result)
 {
     // Exercise system
     var message = await result.ExecuteAsync(new CancellationToken());
     // Verify outcome
     message.StatusCode.Should().Be(result.StatusCode);
 }
 public void StatusCodeIs200(JSendOkResult result)
 {
     // Exercise system and verify outcome
     result.StatusCode.Should().Be(HttpStatusCode.OK);
 }
 public void IsHttpActionResult(JSendOkResult result)
 {
     // Exercise system and verify outcome
     result.Should().BeAssignableTo<IHttpActionResult>();
 }
 public void ContentIsCorrectlyInitialized(Model content, ApiController controller)
 {
     // Exercise system
     var result = new JSendOkResult<Model>(content, controller);
     // Verify outcome
     result.Content.Should().Be(content);
 }