From 9c8ff9824c05eaad4b4c845c934e0ec9e2ae9f94 Mon Sep 17 00:00:00 2001 From: Chris R Date: Thu, 14 Feb 2019 10:36:24 -0800 Subject: [PATCH] Fix tests --- src/Servers/HttpSys/test/FunctionalTests/HttpsTests.cs | 9 ++++----- .../test/InMemory.FunctionalTests/UpgradeTests.cs | 2 ++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Servers/HttpSys/test/FunctionalTests/HttpsTests.cs b/src/Servers/HttpSys/test/FunctionalTests/HttpsTests.cs index e0a59cbf9bcf..930c0e7611e9 100644 --- a/src/Servers/HttpSys/test/FunctionalTests/HttpsTests.cs +++ b/src/Servers/HttpSys/test/FunctionalTests/HttpsTests.cs @@ -50,14 +50,13 @@ public async Task Https_SendHelloWorld_Success() [ConditionalFact] public async Task Https_EchoHelloWorld_Success() { - using (Utilities.CreateDynamicHttpsServer(out var address, httpContext => + using (Utilities.CreateDynamicHttpsServer(out var address, async httpContext => { - string input = new StreamReader(httpContext.Request.Body).ReadToEnd(); + var input = await new StreamReader(httpContext.Request.Body).ReadToEndAsync(); Assert.Equal("Hello World", input); - byte[] body = Encoding.UTF8.GetBytes("Hello World"); + var body = Encoding.UTF8.GetBytes("Hello World"); httpContext.Response.ContentLength = body.Length; - httpContext.Response.Body.Write(body, 0, body.Length); - return Task.FromResult(0); + await httpContext.Response.Body.WriteAsync(body, 0, body.Length); })) { string response = await SendRequestAsync(address, "Hello World"); diff --git a/src/Servers/Kestrel/test/InMemory.FunctionalTests/UpgradeTests.cs b/src/Servers/Kestrel/test/InMemory.FunctionalTests/UpgradeTests.cs index 03e5dab1b5b0..f36d4e84a19d 100644 --- a/src/Servers/Kestrel/test/InMemory.FunctionalTests/UpgradeTests.cs +++ b/src/Servers/Kestrel/test/InMemory.FunctionalTests/UpgradeTests.cs @@ -33,6 +33,7 @@ public async Task ResponseThrowsAfterUpgrade() { await writer.WriteLineAsync("New protocol data"); await writer.FlushAsync(); + await writer.DisposeAsync(); } upgrade.TrySetResult(true); @@ -79,6 +80,7 @@ public async Task RequestBodyAlwaysEmptyAfterUpgrade() Assert.Equal(send, line); await writer.WriteLineAsync(recv); await writer.FlushAsync(); + await writer.DisposeAsync(); } upgrade.TrySetResult(true);