Fix flaky test (#1397)

This commit is contained in:
BrennanConroy 2018-02-01 15:13:40 -08:00 committed by GitHub
parent b61dc35ee6
commit 5ade419c53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -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<Exception>();
hubConnection.Closed += ex => closeTcs.TrySetResult(ex);
await hubConnection.StartAsync().OrTimeout();
var exception = Assert.IsType<TimeoutException>(await closeTcs.Task.OrTimeout());
Assert.Equal("Server timeout (100.00ms) elapsed without receiving a message from the server.", exception.Message);
}