anchor.diff:          |> Async.RunSynchronously
   
       match result with
  -    | None          -> assertFailf "Result was expected to be %s" expected
  +    | None -> assertFailf "Result was expected to be %s" expected
       | Some ctx ->
           let body = getBody ctx
           Assert.Equal(expected, body)
  
positive.code:         |> Async.RunSynchronously
  
      match result with
      | None          -> assertFailf "Result was expected to be %s" expected
      | Some ctx ->
          let body = getBody ctx
          Assert.Equal(expected, body)
  
negative.code:         |> Async.RunSynchronously
  
      match result with
      | None -> assertFailf "Result was expected to be %s" expected
      | Some ctx ->
          let body = getBody ctx
          Assert.Equal(expected, body)
  
  [<Fact>]
  let ``Get "/flex" with Accept header of "application/json" returns JSON object`` () =
      let johnDoe =
          {
              FirstName = "John"
              LastName  = "Doe"
              BirthDate = DateTime(1990, 7, 12)
              Height    = 1.85
              Piercings = [| "left ear"; "nose" |]
          }
  
      let ctx, hctx = initNewContext()
      let app = 
          GET >=> choose [
              route "/"     >=> text "Hello World"
              route "/foo"  >=> text "bar"
              route "/flex" >=> negotiate johnDoe
              setStatusCode 404 >=> text "Not found" ]
  
      let headers = HeaderDictionary()
      headers.Add("Accept", StringValues("application/json"))
      ctx.Items.Returns (new Dictionary<obj,obj>() :> IDictionary<obj,obj>) |> ignore
      ctx.Request.Method.ReturnsForAnyArgs "GET" |> ignore
      ctx.Request.Path.ReturnsForAnyArgs (PathString("/flex")) |> ignore
      ctx.Request.Headers.ReturnsForAnyArgs(headers) |> ignore
      ctx.Response.Body <- new MemoryStream()
  
      let expected = "{\"FirstName\":\"John\",\"LastName\":\"Doe\",\"BirthDate\":\"1990-07-12T00:00:00\",\"Height\":1.85,\"Piercings\":[\"left ear\",\"nose\"]}"
  
      let result = 
          hctx
          |> app
          |> Async.RunSynchronously
  
      match result with
      | None -> assertFailf "Result was expected to be %s" expected
      | Some ctx ->
          let body = getBody ctx
          Assert.Equal(expected, body)
          Assert.Equal("application/json", ctx.HttpContext.Response |> getContentType)
  
  [<Fact>]
  let ``Get "/flex" with Accept header of "application/xml; q=0.9, application/json" returns JSON object`` () =
      let johnDoe =
          {
              FirstName = "John"
              LastName  = "Doe"
              BirthDate = DateTime(1990, 7, 12)
              Height    = 1.85
              Piercings = [| "left ear"; "nose" |]
          }
  
      let ctx, hctx = initNewContext()
      let app = 
          GET >=> choose [
              route "/"     >=> text "Hello World"
              route "/foo"  >=> text "bar"
              route "/flex" >=> negotiate johnDoe
              setStatusCode 404 >=> text "Not found" ]
  
      let headers = HeaderDictionary()
      headers.Add("Accept", StringValues("application/xml; q=0.9, application/json"))
      ctx.Items.Returns (new Dictionary<obj,obj>() :> IDictionary<obj,obj>) |> ignore
      ctx.Request.Method.ReturnsForAnyArgs "GET" |> ignore
      ctx.Request.Path.ReturnsForAnyArgs (PathString("/flex")) |> ignore
      ctx.Request.Headers.ReturnsForAnyArgs(headers) |> ignore
      ctx.Response.Body <- new MemoryStream()
  
      let expected = "{\"FirstName\":\"John\",\"LastName\":\"Doe\",\"BirthDate\":\"1990-07-12T00:00:00\",\"Height\":1.85,\"Piercings\":[\"left ear\",\"nose\"]}"
  
      let result = 
          hctx
          |> app
          |> Async.RunSynchronously
  
      match result with
      | None -> assertFailf "Result was expected to be %s" expected
      | Some ctx ->
          let body = getBody ctx
          Assert.Equal(expected, body)
          Assert.Equal("application/json", ctx.HttpContext.Response |> getContentType)