public async Task Set204StatusCodeWhenChannelComplete() { using (var factory = new ChannelFactory()) { var connection = new Connection(); connection.ConnectionId = Guid.NewGuid().ToString(); var channel = new HttpChannel(factory); connection.Channel = channel; var context = new DefaultHttpContext(); var poll = new LongPolling(connection); channel.Output.CompleteWriter(); await poll.ProcessRequestAsync(context); Assert.Equal(204, context.Response.StatusCode); } }
public async Task NoFramingAddedWhenDataSent() { using (var factory = new ChannelFactory()) { var connection = new Connection(); connection.ConnectionId = Guid.NewGuid().ToString(); var channel = new HttpChannel(factory); connection.Channel = channel; var context = new DefaultHttpContext(); var ms = new MemoryStream(); context.Response.Body = ms; var poll = new LongPolling(connection); await channel.Output.WriteAsync(Encoding.UTF8.GetBytes("Hello World")); channel.Output.CompleteWriter(); await poll.ProcessRequestAsync(context); Assert.Equal("Hello World", Encoding.UTF8.GetString(ms.ToArray())); } }