diff --git a/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/ResponseSendFileTests.cs b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/ResponseSendFileTests.cs index f8d94e1..fb0b739 100644 --- a/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/ResponseSendFileTests.cs +++ b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/Listener/ResponseSendFileTests.cs @@ -253,7 +253,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys.Listener Assert.True(response.Content.Headers.TryGetValues("content-length", out contentLength), "Content-Length"); Assert.Equal(FileLength.ToString(), contentLength.First()); Assert.Null(response.Headers.TransferEncodingChunked); - Assert.Equal(FileLength, response.Content.ReadAsByteArrayAsync().Result.Length); + Assert.Equal(FileLength, (await response.Content.ReadAsByteArrayAsync()).Length); } } diff --git a/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/OpaqueUpgradeTests.cs b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/OpaqueUpgradeTests.cs index a37dace..c0fdda0 100644 --- a/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/OpaqueUpgradeTests.cs +++ b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/OpaqueUpgradeTests.cs @@ -40,7 +40,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys Assert.Equal(200, (int)response.StatusCode); Assert.False(response.Headers.TransferEncodingChunked.HasValue, "Chunked"); Assert.Equal(0, response.Content.Headers.ContentLength); - Assert.Equal(string.Empty, response.Content.ReadAsStringAsync().Result); + Assert.Equal(string.Empty, await response.Content.ReadAsStringAsync()); } } diff --git a/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/ResponseBodyTests.cs b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/ResponseBodyTests.cs index 4c3089e..a42071b 100644 --- a/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/ResponseBodyTests.cs +++ b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/ResponseBodyTests.cs @@ -122,7 +122,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys } [ConditionalFact] - public void ResponseBody_WriteContentLengthNotEnoughWritten_Throws() + public async Task ResponseBody_WriteContentLengthNotEnoughWritten_Throws() { string address; using (Utilities.CreateHttpServer(out address, httpContext => @@ -131,7 +131,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys return httpContext.Response.Body.WriteAsync(new byte[5], 0, 5); })) { - Assert.Throws(() => SendRequestAsync(address).Result); + await Assert.ThrowsAsync(async () => await SendRequestAsync(address)); } } diff --git a/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/ResponseSendFileTests.cs b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/ResponseSendFileTests.cs index 09fd9c3..02117c6 100644 --- a/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/ResponseSendFileTests.cs +++ b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/ResponseSendFileTests.cs @@ -274,7 +274,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys Assert.True(response.Content.Headers.TryGetValues("content-length", out contentLength), "Content-Length"); Assert.Equal(FileLength.ToString(), contentLength.First()); Assert.Null(response.Headers.TransferEncodingChunked); - Assert.Equal(FileLength, response.Content.ReadAsByteArrayAsync().Result.Length); + Assert.Equal(FileLength, (await response.Content.ReadAsByteArrayAsync()).Length); } } diff --git a/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/ServerTests.cs b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/ServerTests.cs index 01224b2..9e5bc9e 100644 --- a/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/ServerTests.cs +++ b/test/Microsoft.AspNetCore.Server.HttpSys.FunctionalTests/ServerTests.cs @@ -135,7 +135,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys } [ConditionalFact] - public void Server_AppException_ClientReset() + public async Task Server_AppException_ClientReset() { string address; using (Utilities.CreateHttpServer(out address, httpContext => @@ -144,11 +144,11 @@ namespace Microsoft.AspNetCore.Server.HttpSys })) { Task requestTask = SendRequestAsync(address); - Assert.Throws(() => requestTask.Result); + await Assert.ThrowsAsync(async () => await requestTask); // Do it again to make sure the server didn't crash requestTask = SendRequestAsync(address); - Assert.Throws(() => requestTask.Result); + await Assert.ThrowsAsync(async () => await requestTask); } }