Skip to content

Commit cbc56af

Browse files
authored
Merge pull request #20150 from dotnet-maestro-bot/merge/release/3.1-to-master
[automated] Merge branch 'release/3.1' => 'master'
2 parents a47515f + 8ad805b commit cbc56af

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

src/SignalR/clients/csharp/Client/test/UnitTests/HubConnectionTests.cs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -448,22 +448,15 @@ public async Task CanAwaitInvokeFromOnHandlerWithServerClosingConnection()
448448
return Task.CompletedTask;
449449
};
450450

451-
await connection.ReceiveJsonMessage(new { type = HubProtocolConstants.InvocationMessageType, target = "Echo", arguments = new object[] { "42" } });
451+
await connection.ReceiveJsonMessage(new { type = HubProtocolConstants.InvocationMessageType, target = "Echo", arguments = new object[] { "42" } }).OrTimeout();
452452

453453
// Read sent message first to make sure invoke has been processed and is waiting for a response
454454
await connection.ReadSentJsonAsync().OrTimeout();
455-
await connection.ReceiveJsonMessage(new { type = HubProtocolConstants.CloseMessageType });
455+
await connection.ReceiveJsonMessage(new { type = HubProtocolConstants.CloseMessageType }).OrTimeout();
456456

457457
await closedTcs.Task.OrTimeout();
458458

459-
try
460-
{
461-
await tcs.Task.OrTimeout();
462-
Assert.True(false);
463-
}
464-
catch (TaskCanceledException)
465-
{
466-
}
459+
await Assert.ThrowsAsync<TaskCanceledException>(() => tcs.Task.OrTimeout());
467460
}
468461
}
469462

0 commit comments

Comments
 (0)