Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 49a62ed

Browse files
Drawaesstephentoub
authored andcommitted
Removing unneeded blocking from tests (#25399)
1 parent e4a35b9 commit 49a62ed

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.DefaultProxyCredentials.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public void SetGet_Roundtrips()
4646
[ActiveIssue(20010, TargetFrameworkMonikers.Uap)]
4747
[OuterLoop] // TODO: Issue #11345
4848
[Fact]
49-
public void ProxyExplicitlyProvided_DefaultCredentials_Ignored()
49+
public async Task ProxyExplicitlyProvided_DefaultCredentials_Ignored()
5050
{
5151
int port;
5252
Task<LoopbackGetRequestHttpProxy.ProxyResult> proxyTask = LoopbackGetRequestHttpProxy.StartAsync(out port, requireAuth: true, expectCreds: true);
@@ -66,7 +66,7 @@ public void ProxyExplicitlyProvided_DefaultCredentials_Ignored()
6666
{
6767
using (t.Result) return t.Result.Content.ReadAsStringAsync();
6868
}, TaskScheduler.Default).Unwrap();
69-
Task.WaitAll(proxyTask, responseTask, responseStringTask);
69+
await (new Task[] { proxyTask, responseTask, responseStringTask }).WhenAllOrAnyFailed();
7070

7171
TestHelper.VerifyResponseBody(responseStringTask.Result, responseTask.Result.Content.Headers.ContentMD5, false, null);
7272
Assert.Equal(Encoding.ASCII.GetString(proxyTask.Result.ResponseContent), responseStringTask.Result);

src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public void Ctor_ExpectedDefaultPropertyValues_NotUapPlatform()
156156
Assert.False(handler.PreAuthenticate);
157157
Assert.True(handler.SupportsProxy);
158158
Assert.True(handler.SupportsRedirectConfiguration);
159-
159+
160160
// Changes from .NET Framework (Desktop).
161161
if (!PlatformDetection.IsFullFramework)
162162
{
@@ -329,7 +329,7 @@ public async Task SendAsync_GetWithInvalidHostHeader_ThrowsException()
329329
}
330330
}
331331

332-
[ActiveIssue(22158, TargetFrameworkMonikers.Uap)]
332+
[ActiveIssue(22158, TargetFrameworkMonikers.Uap)]
333333
[OuterLoop] // TODO: Issue #11345
334334
[Fact]
335335
public async Task GetAsync_IPv6LinkLocalAddressUri_Success()
@@ -599,7 +599,7 @@ await LoopbackServer.CreateServerAsync(async (origServer, origUrl) =>
599599
"\r\n");
600600
await TestHelper.WhenAllCompletedOrAnyFailed(getResponseTask, serverTask);
601601

602-
List <string> receivedRequest = await serverTask;
602+
List<string> receivedRequest = await serverTask;
603603
string[] statusLineParts = receivedRequest[0].Split(' ');
604604

605605
using (HttpResponseMessage response = await getResponseTask)
@@ -1392,7 +1392,7 @@ public async Task GetAsync_StatusCodeOutOfRange_ExpectedException(int statusCode
13921392
// UAP platform allows this status code due to historical reasons.
13931393
return;
13941394
}
1395-
1395+
13961396
await LoopbackServer.CreateServerAsync(async (server, url) =>
13971397
{
13981398
using (HttpClient client = CreateHttpClient())
@@ -2158,7 +2158,7 @@ await response.Content.ReadAsStringAsync(),
21582158
[SkipOnTargetFramework(TargetFrameworkMonikers.Uap, "UAP does not support custom proxies.")]
21592159
[OuterLoop] // TODO: Issue #11345
21602160
[Fact]
2161-
public void Proxy_HaveNoCredsAndUseAuthenticatedCustomProxy_ProxyAuthenticationRequiredStatusCode()
2161+
public async Task Proxy_HaveNoCredsAndUseAuthenticatedCustomProxy_ProxyAuthenticationRequiredStatusCode()
21622162
{
21632163
int port;
21642164
Task<LoopbackGetRequestHttpProxy.ProxyResult> proxyTask = LoopbackGetRequestHttpProxy.StartAsync(
@@ -2172,7 +2172,7 @@ public void Proxy_HaveNoCredsAndUseAuthenticatedCustomProxy_ProxyAuthenticationR
21722172
using (var client = new HttpClient(handler))
21732173
{
21742174
Task<HttpResponseMessage> responseTask = client.GetAsync(Configuration.Http.RemoteEchoServer);
2175-
Task.WaitAll(proxyTask, responseTask);
2175+
await (new Task[] { proxyTask, responseTask }).WhenAllOrAnyFailed();
21762176
using (responseTask.Result)
21772177
{
21782178
Assert.Equal(HttpStatusCode.ProxyAuthenticationRequired, responseTask.Result.StatusCode);

src/System.Net.Http/tests/FunctionalTests/HttpContentTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public async Task CopyToAsync_BufferContentFirst_UseBufferedStreamAsSource()
108108
{
109109
var data = new byte[10];
110110
var content = new MockContent(data);
111-
content.LoadIntoBufferAsync().Wait();
111+
await content.LoadIntoBufferAsync();
112112

113113
Assert.Equal(1, content.SerializeToStreamAsyncCount);
114114
var destination = new MemoryStream();

0 commit comments

Comments
 (0)