220 references to MethodHub
Microsoft.AspNetCore.SignalR.Tests (220)
HubConnectionHandlerTests.Activity.cs (24)
48var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 55AssertHubMethodActivity<MethodHub>(connectActivity, mockHttpRequestActivity, nameof(MethodHub.OnConnectedAsync), linkedActivity: null, activityName: SignalRServerActivitySource.OnConnected); 57await client.SendInvocationAsync(nameof(MethodHub.Echo), "test").DefaultTimeout(); 64AssertHubMethodActivity<MethodHub>(invocation1Activity, parent: null, nameof(MethodHub.Echo), mockHttpRequestActivity); 70AssertHubMethodActivity<MethodHub>(invocation2Activity, parent: null, "RenamedMethod", mockHttpRequestActivity); 72await client.SendInvocationAsync(nameof(MethodHub.ActivityMethod)).DefaultTimeout(); 76AssertHubMethodActivity<MethodHub>(invocation3Activity, parent: null, nameof(MethodHub.ActivityMethod), mockHttpRequestActivity); 88AssertHubMethodActivity<MethodHub>(disconnectActivity, mockHttpRequestActivity, nameof(MethodHub.OnDisconnectedAsync), linkedActivity: null, activityName: SignalRServerActivitySource.OnDisconnected); 123var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 130AssertHubMethodActivity<MethodHub>(connectActivity, mockHttpRequestActivity, nameof(MethodHub.OnConnectedAsync), linkedActivity: null, activityName: SignalRServerActivitySource.OnConnected); 139await client.SendInvocationAsync(nameof(MethodHub.Echo), headers, "test").DefaultTimeout(); 146AssertHubMethodActivity<MethodHub>(invocationActivity, parent: null, nameof(MethodHub.Echo), mockHttpRequestActivity); 160AssertHubMethodActivity<MethodHub>(disconnectActivity, mockHttpRequestActivity, nameof(MethodHub.OnDisconnectedAsync), linkedActivity: null, activityName: SignalRServerActivitySource.OnDisconnected); 474var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 480_ = await client.InvokeAsync(nameof(MethodHub.MethodThatThrows)).DefaultTimeout(); 485AssertHubMethodActivity<MethodHub>(activity, parent: null, nameof(MethodHub.MethodThatThrows),
HubConnectionHandlerTests.ClientResult.cs (23)
19var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 25var invocationId = await client.SendHubMessageAsync(new InvocationMessage("1", nameof(MethodHub.GetClientResult), new object[] { 5 })).DefaultTimeout(); 52var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 58var invocationId = await client.SendHubMessageAsync(new InvocationMessage("1", nameof(MethodHub.GetClientResult), new object[] { 5 })).DefaultTimeout(); 136var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 145var context = serviceProvider.GetRequiredService<IHubContext<MethodHub>>(); 237var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 244_ = await client.SendHubMessageAsync(new InvocationMessage("1", nameof(MethodHub.BlockingMethod), Array.Empty<object>())).DefaultTimeout(); 247var invocationId = await client.SendHubMessageAsync(new InvocationMessage("2", nameof(MethodHub.GetClientResult), new object[] { 5 })).DefaultTimeout(); 248var invocationId2 = await client.SendHubMessageAsync(new InvocationMessage("3", nameof(MethodHub.GetClientResult), new object[] { 5 })).DefaultTimeout(); 249var invocationId3 = await client.SendHubMessageAsync(new InvocationMessage("4", nameof(MethodHub.GetClientResult), new object[] { 5 })).DefaultTimeout(); 291var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 297var completionMessage = await client.InvokeAsync(nameof(MethodHub.BackgroundClientResult)).DefaultTimeout(); 315completionMessage = await client.InvokeAsync(nameof(MethodHub.ValueMethod)).DefaultTimeout(); 405var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 415var context = serviceProvider.GetRequiredService<IHubContext<MethodHub>>(); 418var resultTask = context.Clients.Client(connectionId).InvokeAsync<int>(nameof(MethodHub.GetClientResult), 1, cts.Token); 450var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 459var invocationId = await client.BeginUploadStreamAsync("1", nameof(MethodHub.GetClientResultWithStream), new[] { streamId }, Array.Empty<object>()).DefaultTimeout(); 475var completionMessage = await client.InvokeAsync(nameof(MethodHub.ValueMethod)).DefaultTimeout(); 487var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 497var invocationId = await client.SendStreamInvocationAsync(nameof(MethodHub.StreamWithClientResult)).DefaultTimeout(); 513completionMessage = await client.InvokeAsync(nameof(MethodHub.ValueMethod)).DefaultTimeout();
HubConnectionHandlerTests.cs (141)
800var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 806var result = (await client.InvokeAsync(nameof(MethodHub.TaskValueMethod)).DefaultTimeout()).Result; 826var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 832var result = (await client.InvokeAsync(nameof(MethodHub.ValueTaskValueMethod)).DefaultTimeout()).Result; 852var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 858var result = (await client.InvokeAsync(nameof(MethodHub.ValueTaskMethod)).DefaultTimeout()).Result; 895[InlineData(nameof(MethodHub.MethodThatThrows), true)] 896[InlineData(nameof(MethodHub.MethodThatYieldsFailedTask), false)] 922var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 954var connectionHandler = HubConnectionHandlerTestUtils.GetHubConnectionHandler(typeof(MethodHub), loggerFactory: LoggerFactory); 960await client.SendInvocationAsync(nameof(MethodHub.BlockingMethod)).DefaultTimeout(); 989var methodName = nameof(MethodHub.ThrowHubException); 991var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 1016var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 1022await client.SendInvocationAsync(nameof(MethodHub.ValueMethod), nonBlocking: true).DefaultTimeout(); 1045var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 1051var result = (await client.InvokeAsync(nameof(MethodHub.VoidMethod)).DefaultTimeout()).Result; 1070var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 1116[InlineData(nameof(MethodHub.VoidMethod))] 1117[InlineData(nameof(MethodHub.MethodThatThrows))] 1118[InlineData(nameof(MethodHub.ValueMethod))] 1123return methodName == nameof(MethodHub.MethodThatThrows) && writeContext.LoggerName == "Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher" && 1131var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 1159var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 1165var result = (await client.InvokeAsync(nameof(MethodHub.ConcatString), (byte)32, 42, 'm', "string").DefaultTimeout()).Result; 1234var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 1240var result = await client.InvokeAsync(nameof(MethodHub.OnDisconnectedAsync)).DefaultTimeout(); 1278var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 1284var result = await client.InvokeAsync(nameof(MethodHub.StaticMethod)).DefaultTimeout(); 1303var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 1309var result = await client.InvokeAsync(nameof(MethodHub.ToString)).DefaultTimeout(); 1312result = await client.InvokeAsync(nameof(MethodHub.GetHashCode)).DefaultTimeout(); 1315result = await client.InvokeAsync(nameof(MethodHub.Equals)).DefaultTimeout(); 1318result = await client.InvokeAsync(nameof(MethodHub.ReferenceEquals)).DefaultTimeout(); 1336var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 1342var result = await client.InvokeAsync(nameof(MethodHub.Dispose)).DefaultTimeout(); 1383await firstClient.SendInvocationAsync(nameof(MethodHub.BroadcastMethod), "test").DefaultTimeout(); 1411var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 1421await firstClient.SendInvocationAsync(nameof(MethodHub.SendArray)).DefaultTimeout(); 1659await firstClient.SendInvocationAsync(nameof(MethodHub.SendToMultipleUsers), new[] { "userB", "userC" }, "Second and Third").DefaultTimeout(); 1710result = (await secondClient.InvokeAsync(nameof(MethodHub.GroupAddMethod), "testGroup").DefaultTimeout()).Result; 1712await firstClient.SendInvocationAsync(nameof(MethodHub.GroupSendMethod), "testGroup", "test").DefaultTimeout(); 1754await firstClient.InvokeAsync(nameof(MethodHub.GroupAddMethod), "testGroup").DefaultTimeout(); 1755await secondClient.InvokeAsync(nameof(MethodHub.GroupAddMethod), "testGroup").DefaultTimeout(); 1807await firstClient.InvokeAsync(nameof(MethodHub.GroupAddMethod), "testGroup").DefaultTimeout(); 1808await secondClient.InvokeAsync(nameof(MethodHub.GroupAddMethod), "testGroup").DefaultTimeout(); 1850await secondClient.InvokeAsync(nameof(MethodHub.GroupAddMethod), "GroupA").DefaultTimeout(); 1851await firstClient.InvokeAsync(nameof(MethodHub.GroupAddMethod), "GroupB").DefaultTimeout(); 1854await firstClient.SendInvocationAsync(nameof(MethodHub.SendToMultipleGroups), "test", groupNames).DefaultTimeout(); 1884var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 1890await client.SendInvocationAsync(nameof(MethodHub.GroupRemoveMethod), "testGroup").DefaultTimeout(); 2129var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 2142await client1.SendInvocationAsync(nameof(MethodHub.BroadcastMethod), sentMessage); 2205var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 2213var message = await client.InvokeAsync(nameof(MethodHub.AuthMethod)).DefaultTimeout(); 2241var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 2250var message = await client.InvokeAsync(nameof(MethodHub.AuthMethod)).DefaultTimeout(); 2280var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 2309Assert.Equal(typeof(MethodHub), resource.Hub.GetType()); 2310Assert.Equal(nameof(MethodHub.MultiParamAuthMethod), resource.HubMethodName); 2318Assert.Equal(typeof(MethodHub).GetMethod(nameof(MethodHub.MultiParamAuthMethod)), resource.HubMethod); 2343var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 2358var message = await client.InvokeAsync(nameof(MethodHub.MultiParamAuthMethod), "Hello", "World!").DefaultTimeout(); 2387var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 2395await client.SendInvocationAsync(nameof(MethodHub.BroadcastItem)).DefaultTimeout(); 2417var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 2425await client.SendInvocationAsync(nameof(MethodHub.BroadcastItem)).DefaultTimeout(); 2455var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 2465await client.SendInvocationAsync(nameof(MethodHub.BroadcastItem)).DefaultTimeout(); 2493var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 2517var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 2550var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 2561await client2.SendInvocationAsync(nameof(MethodHub.SendToMultipleUsers), new[] { "client1" }, "Hi!").DefaultTimeout(); 2614var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 2628var result = (await client.InvokeAsync(nameof(MethodHub.HasHttpContext)).DefaultTimeout()).Result; 2645var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 2653var result = (await client.InvokeAsync(nameof(MethodHub.HasHttpContext)).DefaultTimeout()).Result; 2669var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 2680var completion = await client.InvokeAsync(nameof(MethodHub.ValueMethod)).DefaultTimeout(); 2698var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 2744var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 2806var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 2823var id = await client.SendInvocationAsync(nameof(MethodHub.ValueMethod)).DefaultTimeout(); 2842var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 2905var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 2922var id = await client.SendInvocationAsync(nameof(MethodHub.ValueMethod)).DefaultTimeout(); 3105var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 3597var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 3602await client.BeginUploadStreamAsync("invocationId", nameof(MethodHub.StreamDontRead), new[] { "id" }, Array.Empty<object>()).DefaultTimeout(); 3621var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 3626await client.BeginUploadStreamAsync("invocation", nameof(MethodHub.StreamingConcat), new[] { "id" }, Array.Empty<object>()); 3644var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 3649await client.BeginUploadStreamAsync("invocation", nameof(MethodHub.UploadArray), new[] { "id" }, Array.Empty<object>()); 3672var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 3681await client.BeginUploadStreamAsync("invocation_" + id, nameof(MethodHub.StreamingConcat), new[] { id }, Array.Empty<object>()); 3736var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 3741await client.BeginUploadStreamAsync("invocation", nameof(MethodHub.UploadArrayAuth), new[] { "id" }, Array.Empty<object>()); 3802var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 3808await client.SendInvocationAsync(nameof(MethodHub.ProtocolError)).DefaultTimeout(); 3868var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 3873await client.BeginUploadStreamAsync("invocation", nameof(MethodHub.StreamingConcat), streamIds: new[] { "id" }, Array.Empty<object>()).DefaultTimeout(); 3919var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 3924await client.BeginUploadStreamAsync("invocationId", nameof(MethodHub.TestTypeCastingErrors), new[] { "channelId" }, Array.Empty<object>()).DefaultTimeout(); 3946var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 3971var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 3995var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 4000await client.BeginUploadStreamAsync("invocation", nameof(MethodHub.TestCustomErrorPassing), streamIds: new[] { "id" }, args: Array.Empty<object>()).DefaultTimeout(); 4015var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 4020await client.BeginUploadStreamAsync("invocation", nameof(MethodHub.StreamingConcat), streamIds: new[] { "id", "id2" }, args: Array.Empty<object>()).DefaultTimeout(); 4034var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 4039await client.BeginUploadStreamAsync("invocation", nameof(MethodHub.StreamingConcat), streamIds: Array.Empty<string>(), args: Array.Empty<object>()).DefaultTimeout(); 4056var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 4062await client.BeginUploadStreamAsync("invocation", nameof(MethodHub.StreamingConcat), streamIds: new[] { "id" }, args: Array.Empty<object>()).DefaultTimeout(); 4072var hubActivator = serviceProvider.GetService<IHubActivator<MethodHub>>() as CustomHubActivator<MethodHub>; 4094var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 4100var hubActivator = serviceProvider.GetService<IHubActivator<MethodHub>>() as CustomHubActivator<MethodHub>; 4104await client.BeginUploadStreamAsync(invocationId: null, nameof(MethodHub.StreamingConcat), streamIds: new[] { "id" }, args: Array.Empty<object>()).DefaultTimeout(); 4131var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 4137await client.BeginUploadStreamAsync("invocation", nameof(MethodHub.UploadIgnoreItems), streamIds: new[] { "id" }, args: Array.Empty<object>()).DefaultTimeout(); 4168var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 4174await client.SendStreamInvocationAsync(nameof(MethodHub.StreamAndUploadIgnoreItems), streamIds: new[] { "id" }, args: Array.Empty<object>()).DefaultTimeout(); 4384var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 4390var invocationId = await client.SendInvocationAsync(nameof(MethodHub.InvalidArgument)).DefaultTimeout(); 4538var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 4547IHubContext context = (IHubContext)serviceProvider.GetRequiredService<IHubContext<MethodHub>>(); 4563var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 4574await client.BeginUploadStreamAsync("invocation", nameof(MethodHub.UploadDoesWorkOnComplete), streamIds: new[] { "id" }, args: Array.Empty<object>()).DefaultTimeout(); 4583var task = (Task<int>)client.Connection.Items[nameof(MethodHub.UploadDoesWorkOnComplete)]; 4599}).AddHubOptions<MethodHub>(o => 4605var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 4628var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 4637IHubContext<TestHub> context = serviceProvider.GetRequiredService<IHubContext<MethodHub>>(); 5172var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 5183var completionMessage = await client.InvokeAsync(nameof(MethodHub.Echo), new object[] { "test" }); 5200var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 5209await client.InvokeAsync(nameof(MethodHub.Echo), new object[] { new string('x', 500) }).DefaultTimeout(); 5212await client.SendInvocationAsync(nameof(MethodHub.Echo), new object[] { "t" }).DefaultTimeout(); 5393yield return new[] { typeof(MethodHub) };
HubFilterTests.cs (32)
62services.AddSignalR().AddHubOptions<MethodHub>(options => 80services.AddSignalR().AddHubOptions<MethodHub>(options => 100services.AddSignalR().AddHubOptions<MethodHub>(options => 114var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 125var message = await client.InvokeAsync(nameof(MethodHub.Echo), "Hello world!").DefaultTimeout(); 188var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 202var message = await client.InvokeAsync(nameof(MethodHub.Echo), "Hello world!").DefaultTimeout(); 238var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 252var message = await client.InvokeAsync(nameof(MethodHub.Echo), "Hello world!").DefaultTimeout(); 280.AddHubOptions<MethodHub>(options => 289var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 303var message = await client.InvokeAsync(nameof(MethodHub.Echo), "Hello world!").DefaultTimeout(); 337var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 352var invokeTask = client.InvokeAsync(nameof(MethodHub.Echo), "Hello world!"); 390.AddHubOptions<MethodHub>(options => 397var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 412var invokeTask = client.InvokeAsync(nameof(MethodHub.Echo), "Hello world!"); 453.AddHubOptions<MethodHub>(options => 459var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 474var invokeTask = client.InvokeAsync(nameof(MethodHub.Echo), "Hello world!"); 539var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 551var message = await client.InvokeAsync(nameof(MethodHub.Echo), "Hello world!").DefaultTimeout(); 588var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 599var message = await client.InvokeAsync(nameof(MethodHub.Echo), "Hello world!").DefaultTimeout(); 662var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 692var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 700var message = await client.InvokeAsync(nameof(MethodHub.Echo), "Hello world!").DefaultTimeout(); 729var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 770var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 805var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 846var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>(); 884var connectionHandler = serviceProvider.GetService<HubConnectionHandler<MethodHub>>();