diff --git a/test/Microsoft.AspNetCore.SignalR.Client.Tests/HubConnectionTests.Protocol.cs b/test/Microsoft.AspNetCore.SignalR.Client.Tests/HubConnectionTests.Protocol.cs index 6ae213480d..43a19cd1db 100644 --- a/test/Microsoft.AspNetCore.SignalR.Client.Tests/HubConnectionTests.Protocol.cs +++ b/test/Microsoft.AspNetCore.SignalR.Client.Tests/HubConnectionTests.Protocol.cs @@ -403,7 +403,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.Tests [Fact] public async Task PartialHandshakeResponseWorks() { - var connection = new TestConnection(synchronousCallbacks: true, autoHandshake: false); + var connection = new TestConnection(autoHandshake: false); var hubConnection = CreateHubConnection(connection); try { @@ -432,7 +432,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.Tests public async Task HandshakeAndInvocationInSameBufferWorks() { var payload = "{}\u001e{\"type\":1, \"target\": \"Echo\", \"arguments\":[\"hello\"]}\u001e"; - var connection = new TestConnection(synchronousCallbacks: true, autoHandshake: false); + var connection = new TestConnection(autoHandshake: false); var hubConnection = CreateHubConnection(connection); try { @@ -459,7 +459,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.Tests [Fact] public async Task PartialInvocationWorks() { - var connection = new TestConnection(synchronousCallbacks: true); + var connection = new TestConnection(); var hubConnection = CreateHubConnection(connection); try { diff --git a/test/Microsoft.AspNetCore.SignalR.Client.Tests/TestConnection.cs b/test/Microsoft.AspNetCore.SignalR.Client.Tests/TestConnection.cs index 65a41af9aa..b458330203 100644 --- a/test/Microsoft.AspNetCore.SignalR.Client.Tests/TestConnection.cs +++ b/test/Microsoft.AspNetCore.SignalR.Client.Tests/TestConnection.cs @@ -42,14 +42,13 @@ namespace Microsoft.AspNetCore.SignalR.Client.Tests public override IDictionary Items { get; set; } = new ConnectionItems(); - public TestConnection(Func onStart = null, Func onDispose = null, bool autoHandshake = true, bool synchronousCallbacks = false) + public TestConnection(Func onStart = null, Func onDispose = null, bool autoHandshake = true) { _autoHandshake = autoHandshake; _onStart = onStart ?? (() => Task.CompletedTask); _onDispose = onDispose ?? (() => Task.CompletedTask); - var scheduler = synchronousCallbacks ? PipeScheduler.Inline : null; - var options = new PipeOptions(readerScheduler: scheduler, writerScheduler: scheduler, useSynchronizationContext: false); + var options = new PipeOptions(readerScheduler: PipeScheduler.Inline, writerScheduler: PipeScheduler.Inline, useSynchronizationContext: false); var pair = DuplexPipe.CreateConnectionPair(options, options); Application = pair.Application; diff --git a/test/Microsoft.AspNetCore.SignalR.Tests.Utils/TestClient.cs b/test/Microsoft.AspNetCore.SignalR.Tests.Utils/TestClient.cs index 8eaf686d42..80f78c03bc 100644 --- a/test/Microsoft.AspNetCore.SignalR.Tests.Utils/TestClient.cs +++ b/test/Microsoft.AspNetCore.SignalR.Tests.Utils/TestClient.cs @@ -32,10 +32,9 @@ namespace Microsoft.AspNetCore.SignalR.Tests public TransferFormat ActiveFormat { get; set; } - public TestClient(bool synchronousCallbacks = false, IHubProtocol protocol = null, IInvocationBinder invocationBinder = null, bool addClaimId = false) + public TestClient(IHubProtocol protocol = null, IInvocationBinder invocationBinder = null, bool addClaimId = false) { - var scheduler = synchronousCallbacks ? PipeScheduler.Inline : null; - var options = new PipeOptions(readerScheduler: scheduler, writerScheduler: scheduler, useSynchronizationContext: false); + var options = new PipeOptions(readerScheduler: PipeScheduler.Inline, writerScheduler: PipeScheduler.Inline, useSynchronizationContext: false); var pair = DuplexPipe.CreateConnectionPair(options, options); Connection = new DefaultConnectionContext(Guid.NewGuid().ToString(), pair.Transport, pair.Application); diff --git a/test/Microsoft.AspNetCore.SignalR.Tests/HubConnectionHandlerTests.cs b/test/Microsoft.AspNetCore.SignalR.Tests/HubConnectionHandlerTests.cs index e953ed9dda..e84cc14a5a 100644 --- a/test/Microsoft.AspNetCore.SignalR.Tests/HubConnectionHandlerTests.cs +++ b/test/Microsoft.AspNetCore.SignalR.Tests/HubConnectionHandlerTests.cs @@ -194,7 +194,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests var part2 = Encoding.UTF8.GetBytes(",\"version\": 1}"); var part3 = Encoding.UTF8.GetBytes("\u001e"); - using (var client = new TestClient(synchronousCallbacks: true)) + using (var client = new TestClient()) { client.SupportedFormats = TransferFormat.Text; @@ -234,7 +234,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests var part2 = Encoding.UTF8.GetBytes("\"target\": \"Echo\", \"arguments\""); var part3 = Encoding.UTF8.GetBytes(":[\"hello\"]}\u001e"); - using (var client = new TestClient(synchronousCallbacks: true)) + using (var client = new TestClient()) { client.SupportedFormats = TransferFormat.Text; @@ -272,7 +272,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests var connectionHandler = HubConnectionHandlerTestUtils.GetHubConnectionHandler(typeof(HubT)); var payload = Encoding.UTF8.GetBytes("{\"protocol\": \"json\",\"version\": 1}\u001e{\"type\":1, \"invocationId\":\"1\", \"target\": \"Echo\", \"arguments\":[\"hello\"]}\u001e"); - using (var client = new TestClient(synchronousCallbacks: true)) + using (var client = new TestClient()) { client.SupportedFormats = TransferFormat.Text; @@ -616,7 +616,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests var connectionHandler = serviceProvider.GetService>(); - using (var client = new TestClient(synchronousCallbacks: true)) + using (var client = new TestClient()) { var connectionHandlerTask = await client.ConnectAsync(connectionHandler); @@ -1392,7 +1392,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests var invocationBinder = new Mock(); invocationBinder.Setup(b => b.GetReturnType(It.IsAny())).Returns(typeof(string)); - using (var client = new TestClient(synchronousCallbacks: false, protocol: protocol, invocationBinder: invocationBinder.Object)) + using (var client = new TestClient(protocol: protocol, invocationBinder: invocationBinder.Object)) { client.SupportedFormats = protocol.TransferFormat; @@ -1684,7 +1684,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests var connectionHandler = serviceProvider.GetService>(); var msgPackOptions = serviceProvider.GetRequiredService>(); - using (var client = new TestClient(synchronousCallbacks: false, protocol: new MessagePackHubProtocol(msgPackOptions))) + using (var client = new TestClient(protocol: new MessagePackHubProtocol(msgPackOptions))) { client.SupportedFormats = TransferFormat.Binary; var connectionHandlerTask = await client.ConnectAsync(connectionHandler); @@ -1805,7 +1805,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests var serviceProvider = HubConnectionHandlerTestUtils.CreateServiceProvider(); var connectionHandler = serviceProvider.GetService>(); - using (var client = new TestClient(false, new JsonHubProtocol())) + using (var client = new TestClient(new JsonHubProtocol())) { var connectionHandlerTask = await client.ConnectAsync(connectionHandler); await client.Connected.OrTimeout(); @@ -1831,7 +1831,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests options.KeepAliveInterval = TimeSpan.FromMilliseconds(100))); var connectionHandler = serviceProvider.GetService>(); - using (var client = new TestClient(false, new JsonHubProtocol())) + using (var client = new TestClient(new JsonHubProtocol())) { var connectionHandlerTask = await client.ConnectAsync(connectionHandler); @@ -1872,7 +1872,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests options.KeepAliveInterval = TimeSpan.FromMilliseconds(100))); var connectionHandler = serviceProvider.GetService>(); - using (var client = new TestClient(false, new JsonHubProtocol())) + using (var client = new TestClient(new JsonHubProtocol())) { var connectionHandlerTask = await client.ConnectAsync(connectionHandler); await client.Connected.OrTimeout(); @@ -1928,7 +1928,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests var serviceProvider = HubConnectionHandlerTestUtils.CreateServiceProvider(); var connectionHandler = serviceProvider.GetService>(); - using (var client = new TestClient(false, new JsonHubProtocol())) + using (var client = new TestClient(new JsonHubProtocol())) { var connectionHandlerTask = await client.ConnectAsync(connectionHandler); @@ -1962,7 +1962,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests }); var connectionHandler = serviceProvider.GetService>(); - using (var client = new TestClient(false, new JsonHubProtocol())) + using (var client = new TestClient(new JsonHubProtocol())) { var connectionHandlerTask = await client.ConnectAsync(connectionHandler);