anchor.diff:              testCase "single binary message" <| fun _ ->
                   testPayloadToString [Message(Binary([|1uy;2uy;3uy|] |> Segment.ofArray))] "6:b4AQID" "message"
           ]
  +
  +        testList "packet to binary" [
  +            testCase "open" <| fun _ ->
  +                let handshake = { Sid= "xxx";Upgrades=[|"foo";"bar"|];PingTimeout=42; PingInterval=43 }
  +                let handshakeStr = @"{""sid"":""xxx"",""upgrades"":[""foo"",""bar""],""pingTimeout"":42,""pingInterval"":43}"
  +                testPacketToBinary (Open(handshake)) ([0] |> appendUtf8 handshakeStr) "open"
  +
  +            testCase "close" <| fun _ ->
  +                testPacketToBinary (Close) [1] "close"
  +
  +            testCase "ping" <| fun _ ->
  +                testPacketToBinary (Ping(String("probe"))) ([2] |> appendUtf8 "probe") "ping"
  +
  +            testCase "ping (binary)" <| fun _ ->
  +                testPacketToBinary (Ping(Binary([|1uy;2uy;3uy|] |> Segment.ofArray))) [2;1;2;3] "ping (binary)"
  +
  +            testCase "pong" <| fun _ ->
  +                testPacketToBinary (Pong(String("probe"))) ([3] |> appendUtf8 "probe") "ping"
  +
  +            testCase "pong (binary)" <| fun _ ->
  +                testPacketToBinary (Pong(Binary([|1uy;2uy;3uy|] |> Segment.ofArray))) [3;1;2;3] "pong (binary)"
  +
  +            testCase "message" <| fun _ ->
  +                testPacketToBinary (Message(String("Hello world"))) ([4] |> appendUtf8 "Hello world") "message"
  +
  +            testCase "message (binary)" <| fun _ ->
  +                testPacketToBinary (Message(Binary([|1uy;2uy;3uy|] |> Segment.ofArray))) [4;1;2;3] "message (binary)"
  +
  +            testCase "close" <| fun _ ->
  +                testPacketToBinary (Upgrade) [5] "close"
  +
  +            testCase "noop" <| fun _ ->
  +                testPacketToBinary (Noop) [6] "noop"
  +        ]
       ]
   
   [<EntryPoint>]
  
positive.code: open SocketIoSuave
  open SocketIoSuave.EngineIo.Protocol
  
  let private testPacketToString message expected format =
      Expect.equal (message |> PacketMessage.encodeToString) expected ""
  
  let private testPayloadToString messages expected format =
      Expect.equal (Payload(messages) |> Payload.encodeToString) expected format
  
  [<Tests>]
  let tests =
  
negative.code:             testCase "noop" <| fun _ ->
                  testPacketToString (Noop) "6" "noop"
          ]
  
          testList "payload to string" [
              testCase "empty" <| fun _ ->
                  testPayloadToString [] "0:" "empty"
  