public void ParseMessage_KeepAlive_ParseMessage() { // arrange ReadOnlySequence <byte> message = GetBytes(@"{""type"": ""ka""}"); // act GraphQLWebSocketMessage parsed = GraphQLWebSocketMessageParser.Parse(message); // assert Assert.Equal(GraphQLWebSocketMessageType.KeepAlive, parsed.Type); }
public void ParseMessage_ConnectionTerminate_ParseMessage() { // arrange ReadOnlySequence <byte> message = GetBytes(@"{""type"": ""connection_terminate"" }"); // act GraphQLWebSocketMessage parsed = GraphQLWebSocketMessageParser.Parse(message); // assert Assert.Equal(GraphQLWebSocketMessageType.ConnectionTerminate, parsed.Type); }
public void ParseMessage_ConnectionError_ParseMessage() { // arrange ReadOnlySequence <byte> message = GetBytes(@"{""type"": ""connection_error"", ""payload"": ""payload""}"); // act GraphQLWebSocketMessage parsed = GraphQLWebSocketMessageParser.Parse(message); // assert Assert.Equal(GraphQLWebSocketMessageType.ConnectionError, parsed.Type); Assert.Equal("payload", parsed.Payload.RootElement.ToString()); }
public void ParseMessage_Complete_ParseMessage() { // arrange ReadOnlySequence <byte> message = GetBytes(@"{""type"": ""complete"", ""id"":""123""}"); // act GraphQLWebSocketMessage parsed = GraphQLWebSocketMessageParser.Parse(message); // assert Assert.Equal(GraphQLWebSocketMessageType.Complete, parsed.Type); Assert.Equal("123", parsed.Id); }
public void ParseMessage_Start_ParseMessage() { // arrange ReadOnlySequence <byte> message = GetBytes(@"{""type"": ""start"", ""id"":""123"", ""payload"": ""payload""}"); // act GraphQLWebSocketMessage parsed = GraphQLWebSocketMessageParser.Parse(message); // assert Assert.Equal(GraphQLWebSocketMessageType.Start, parsed.Type); Assert.Equal("123", parsed.Id); Assert.Equal("payload", parsed.Payload.RootElement.ToString()); }