From 5ade419c53f3dc9de581038d459932f56ed33f71 Mon Sep 17 00:00:00 2001 From: BrennanConroy Date: Thu, 1 Feb 2018 15:13:40 -0800 Subject: [PATCH] Fix flaky test (#1397) --- .../HubConnectionTests.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/Microsoft.AspNetCore.SignalR.Client.Tests/HubConnectionTests.cs b/test/Microsoft.AspNetCore.SignalR.Client.Tests/HubConnectionTests.cs index 59d13a9244..72bc1e37b6 100644 --- a/test/Microsoft.AspNetCore.SignalR.Client.Tests/HubConnectionTests.cs +++ b/test/Microsoft.AspNetCore.SignalR.Client.Tests/HubConnectionTests.cs @@ -9,7 +9,6 @@ using Microsoft.AspNetCore.Http.Features; using Microsoft.AspNetCore.SignalR.Internal; using Microsoft.AspNetCore.SignalR.Internal.Protocol; using Microsoft.AspNetCore.Sockets.Client; -using Microsoft.AspNetCore.Sockets.Features; using Microsoft.Extensions.Logging; using Moq; using Xunit; @@ -199,10 +198,11 @@ namespace Microsoft.AspNetCore.SignalR.Client.Tests hubConnection.ServerTimeout = TimeSpan.FromMilliseconds(100); - await hubConnection.StartAsync().OrTimeout(); - var closeTcs = new TaskCompletionSource(); hubConnection.Closed += ex => closeTcs.TrySetResult(ex); + + await hubConnection.StartAsync().OrTimeout(); + var exception = Assert.IsType(await closeTcs.Task.OrTimeout()); Assert.Equal("Server timeout (100.00ms) elapsed without receiving a message from the server.", exception.Message); }