10 instantiations of CompletionMessage
Microsoft.AspNetCore.Components.Server (1)
src\SignalR\common\Protocols.MessagePack\src\Protocol\MessagePackHubProtocolWorker.cs (1)
210return ApplyHeaders(headers, new CompletionMessage(invocationId, error, result, hasResult));
Microsoft.AspNetCore.SignalR.Common (3)
Protocol\CompletionMessage.cs (3)
66=> new CompletionMessage(invocationId, error, result: null, hasResult: false); 75=> new CompletionMessage(invocationId, error: null, result: payload, hasResult: true); 84=> new CompletionMessage(invocationId, error: null, result: null, hasResult: false);
Microsoft.AspNetCore.SignalR.Common.Tests (1)
Internal\Protocol\JsonHubProtocolTestsBase.cs (1)
106new JsonProtocolTestData("CompletionMessage_ResultFirst", new CompletionMessage("15", null, 10, hasResult: true), false, true, "{ \"type\":3, \"result\": 10, \"invocationId\": \"15\" }"),
Microsoft.AspNetCore.SignalR.Protocols.Json (2)
Protocol\JsonHubProtocol.cs (2)
752return new CompletionMessage(invocationId, error, result, hasResult: true); 755return new CompletionMessage(invocationId, error, result: null, hasResult: false);
Microsoft.AspNetCore.SignalR.Protocols.MessagePack (1)
Protocol\MessagePackHubProtocolWorker.cs (1)
210return ApplyHeaders(headers, new CompletionMessage(invocationId, error, result, hasResult));
Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson (2)
Protocol\NewtonsoftJsonHubProtocol.cs (2)
745return new CompletionMessage(invocationId, error, result, hasResult: true); 748return new CompletionMessage(invocationId, error, result: null, hasResult: false);
357 references to CompletionMessage
Microsoft.AspNetCore.Components.Server (3)
src\SignalR\common\Protocols.MessagePack\src\Protocol\MessagePackHubProtocolWorker.cs (3)
159private CompletionMessage CreateCompletionMessage(ref MessagePackReader reader, IInvocationBinder binder) 400case CompletionMessage completionMessage: 525private void WriteCompletionMessage(CompletionMessage message, ref MessagePackWriter writer)
Microsoft.AspNetCore.Components.Server.Tests (16)
src\SignalR\common\SignalR.Common\test\Internal\Protocol\MessagePackHubProtocolTestBase.cs (11)
113message: CompletionMessage.WithError("xyz", error: "Error not found!"), 117message: AddHeaders(TestHeaders, CompletionMessage.WithError("xyz", error: "Error not found!")), 121message: CompletionMessage.Empty("xyz"), 125message: AddHeaders(TestHeaders, CompletionMessage.Empty("xyz")), 129message: CompletionMessage.WithResult("xyz", payload: 42), 133message: CompletionMessage.WithResult("xyz", payload: 42.0f), 137message: CompletionMessage.WithResult("xyz", payload: "string"), 141message: CompletionMessage.WithResult("xyz", payload: true), 424new MessageSizeTestData("CompletionMessage_Empty", CompletionMessage.Empty("1"), 7), 425new MessageSizeTestData("CompletionMessage_WithResult", CompletionMessage.WithResult("1", 1), 8), 426new MessageSizeTestData("CompletionMessage_WithError", CompletionMessage.WithError("1", "error"), 13),
src\SignalR\common\SignalR.Common\test\Internal\Protocol\TestBinder.cs (1)
29case CompletionMessage c:
src\SignalR\common\SignalR.Common\test\Internal\Protocol\TestHubMessageEqualityComparer.cs (4)
31case CompletionMessage completionMessage: 32return CompletionMessagesEqual(completionMessage, (CompletionMessage)y); 51private bool CompletionMessagesEqual(CompletionMessage x, CompletionMessage y)
Microsoft.AspNetCore.SignalR.Client.Core (11)
HubConnection.cs (8)
998await SendHubMessage(connectionState, CompletionMessage.WithError(streamId, responseError), cancellationToken: default).ConfigureAwait(false); 1301await SendWithLock(connectionState, CompletionMessage.WithError(bindingFailure.InvocationId, "Client failed to parse argument(s)."), cancellationToken: default).ConfigureAwait(false); 1308case CompletionMessage completion: 1375await SendWithLock(connectionState, CompletionMessage.WithError(invocation.InvocationId!, "Client didn't provide a result."), cancellationToken: default).ConfigureAwait(false); 1425await SendWithLock(connectionState, CompletionMessage.WithError(invocation.InvocationId!, resultException.Message), cancellationToken: default).ConfigureAwait(false); 1429await SendWithLock(connectionState, CompletionMessage.WithResult(invocation.InvocationId!, result), cancellationToken: default).ConfigureAwait(false); 1434await SendWithLock(connectionState, CompletionMessage.WithError(invocation.InvocationId!, "Client didn't provide a result."), cancellationToken: default).ConfigureAwait(false); 1462private void DispatchInvocationCompletion(CompletionMessage completion, InvocationRequest irq)
Internal\InvocationRequest.cs (3)
64public abstract void Complete(CompletionMessage message); 90public override void Complete(CompletionMessage completionMessage) 178public override void Complete(CompletionMessage completionMessage)
Microsoft.AspNetCore.SignalR.Common (11)
Protocol\CompletionMessage.cs (10)
30/// Constructs a <see cref="CompletionMessage"/>. 60/// Constructs a <see cref="CompletionMessage"/> with an error. 64/// <returns>The constructed <see cref="CompletionMessage"/>.</returns> 65public static CompletionMessage WithError(string invocationId, string? error) 69/// Constructs a <see cref="CompletionMessage"/> with a result. 73/// <returns>The constructed <see cref="CompletionMessage"/>.</returns> 74public static CompletionMessage WithResult(string invocationId, object? payload) 78/// Constructs a <see cref="CompletionMessage"/> without an error or result. 82/// <returns>The constructed <see cref="CompletionMessage"/>.</returns> 83public static CompletionMessage Empty(string invocationId)
Protocol\RawResult.cs (1)
23/// Stores the raw serialized bytes of a <see cref="CompletionMessage.Result"/> for forwarding to another server.
Microsoft.AspNetCore.SignalR.Common.Tests (66)
Internal\Protocol\CompositeTestBinder.cs (1)
35return arg is CompletionMessage ||
Internal\Protocol\JsonHubProtocolTests.cs (4)
190JsonHubProtocol.WriteMessage(CompletionMessage.WithResult("1", todo), writer); 199var completionMessage = Assert.IsType<CompletionMessage>(message); 217new JsonProtocolTestData("CompletionMessage_HasFloatResult", CompletionMessage.WithResult("123", 2.0f), true, true, "{\"type\":3,\"invocationId\":\"123\",\"result\":2}"),
Internal\Protocol\JsonHubProtocolTestsBase.cs (25)
56new JsonProtocolTestData("CompletionMessage_HasCustomResultWithNoCamelCase", CompletionMessage.WithResult("123", new CustomObject()), false, true, "{\"type\":3,\"invocationId\":\"123\",\"result\":{\"StringProp\":\"SignalR!\",\"DoubleProp\":6.2831853071,\"IntProp\":42,\"DateTimeProp\":\"2017-04-11T00:00:00Z\",\"ByteArrProp\":\"AQID\"}}"), 57new JsonProtocolTestData("CompletionMessage_HasCustomResultWithNullValueIgnore", CompletionMessage.WithResult("123", new CustomObject()), true, true, "{\"type\":3,\"invocationId\":\"123\",\"result\":{\"stringProp\":\"SignalR!\",\"doubleProp\":6.2831853071,\"intProp\":42,\"dateTimeProp\":\"2017-04-11T00:00:00Z\",\"byteArrProp\":\"AQID\"}}"), 58new JsonProtocolTestData("CompletionMessage_HasCustomResultWithNullValueIncludeAndNoCamelCase", CompletionMessage.WithResult("123", new CustomObject()), false, false, "{\"type\":3,\"invocationId\":\"123\",\"result\":{\"StringProp\":\"SignalR!\",\"DoubleProp\":6.2831853071,\"IntProp\":42,\"DateTimeProp\":\"2017-04-11T00:00:00Z\",\"NullProp\":null,\"ByteArrProp\":\"AQID\"}}"), 59new JsonProtocolTestData("CompletionMessage_HasCustomResultWithNullValueInclude", CompletionMessage.WithResult("123", new CustomObject()), true, false, "{\"type\":3,\"invocationId\":\"123\",\"result\":{\"stringProp\":\"SignalR!\",\"doubleProp\":6.2831853071,\"intProp\":42,\"dateTimeProp\":\"2017-04-11T00:00:00Z\",\"nullProp\":null,\"byteArrProp\":\"AQID\"}}"), 60new JsonProtocolTestData("CompletionMessage_HasErrorAndCamelCase", CompletionMessage.Empty("123"), true, true, "{\"type\":3,\"invocationId\":\"123\"}"), 61new JsonProtocolTestData("CompletionMessage_HasTestHeadersAndCustomItemResult", AddHeaders(TestHeaders, CompletionMessage.WithResult("123", new CustomObject())), true, false, "{\"type\":3," + SerializedHeaders + ",\"invocationId\":\"123\",\"result\":{\"stringProp\":\"SignalR!\",\"doubleProp\":6.2831853071,\"intProp\":42,\"dateTimeProp\":\"2017-04-11T00:00:00Z\",\"nullProp\":null,\"byteArrProp\":\"AQID\"}}"), 62new JsonProtocolTestData("CompletionMessage_HasErrorAndHeadersAndCamelCase", AddHeaders(TestHeaders, CompletionMessage.Empty("123")), true, true, "{\"type\":3," + SerializedHeaders + ",\"invocationId\":\"123\"}"), 63new JsonProtocolTestData("CompletionMessage_HasIntegerResult", CompletionMessage.WithResult("123", 1), true, true, "{\"type\":3,\"invocationId\":\"123\",\"result\":1}"), 64new JsonProtocolTestData("CompletionMessage_HasStringResult", CompletionMessage.WithResult("123", "Foo"), true, true, "{\"type\":3,\"invocationId\":\"123\",\"result\":\"Foo\"}"), 65new JsonProtocolTestData("CompletionMessage_HasBoolResult", CompletionMessage.WithResult("123", true), true, true, "{\"type\":3,\"invocationId\":\"123\",\"result\":true}"), 66new JsonProtocolTestData("CompletionMessage_HasNullResult", CompletionMessage.WithResult("123", null), true, true, "{\"type\":3,\"invocationId\":\"123\",\"result\":null}"), 67new JsonProtocolTestData("CompletionMessage_HasError", CompletionMessage.WithError("123", "Whoops!"), true, true, "{\"type\":3,\"invocationId\":\"123\",\"error\":\"Whoops!\"}"), 68new JsonProtocolTestData("CompletionMessage_HasErrorAndHeaders", AddHeaders(TestHeaders, CompletionMessage.WithError("123", "Whoops!")), true, true, "{\"type\":3," + SerializedHeaders + ",\"invocationId\":\"123\",\"error\":\"Whoops!\"}"), 296var invocationMessage = Assert.IsType<CompletionMessage>(message); 372new MessageSizeTestData("CompletionMessage_Empty", CompletionMessage.Empty("1"), 30), 373new MessageSizeTestData("CompletionMessage_WithResult", CompletionMessage.WithResult("1", 1), 41), 374new MessageSizeTestData("CompletionMessage_WithError", CompletionMessage.WithError("1", "error"), 46), 443var completion = Assert.IsType<CompletionMessage>(message); 457completion = Assert.IsType<CompletionMessage>(message); 476var completion = Assert.IsType<CompletionMessage>(hubMessage); 492var completion = Assert.IsType<CompletionMessage>(hubMessage);
Internal\Protocol\MessagePackHubProtocolTestBase.cs (11)
113message: CompletionMessage.WithError("xyz", error: "Error not found!"), 117message: AddHeaders(TestHeaders, CompletionMessage.WithError("xyz", error: "Error not found!")), 121message: CompletionMessage.Empty("xyz"), 125message: AddHeaders(TestHeaders, CompletionMessage.Empty("xyz")), 129message: CompletionMessage.WithResult("xyz", payload: 42), 133message: CompletionMessage.WithResult("xyz", payload: 42.0f), 137message: CompletionMessage.WithResult("xyz", payload: "string"), 141message: CompletionMessage.WithResult("xyz", payload: true), 424new MessageSizeTestData("CompletionMessage_Empty", CompletionMessage.Empty("1"), 7), 425new MessageSizeTestData("CompletionMessage_WithResult", CompletionMessage.WithResult("1", 1), 8), 426new MessageSizeTestData("CompletionMessage_WithError", CompletionMessage.WithError("1", "error"), 13),
Internal\Protocol\MessagePackHubProtocolTests.cs (19)
19var result = Write(CompletionMessage.WithResult("0", new List<int> { 42 }.AsReadOnly())); 36HubProtocol.WriteMessage(CompletionMessage.WithResult("xyz", originalDateTime), writer); 40var completionMessage = Assert.IsType<CompletionMessage>(hubMessage); 65HubProtocol.WriteMessage(CompletionMessage.WithResult("xyz", dateTimeOffset), writer); 69var completionMessage = Assert.IsType<CompletionMessage>(hubMessage); 97message: CompletionMessage.WithResult("xyz", payload: null), 101message: CompletionMessage.WithResult("xyz", payload: new CustomObject()), 105message: CompletionMessage.WithResult("xyz", payload: new[] { new CustomObject(), new CustomObject() }), 109message: AddHeaders(TestHeaders, CompletionMessage.WithResult("xyz", payload: new[] { new CustomObject(), new CustomObject() })), 113message: CompletionMessage.WithResult("xyz", payload: TestEnum.One), 223var completion = Assert.IsType<CompletionMessage>(message); 237completion = Assert.IsType<CompletionMessage>(message); 254var completion = Assert.IsType<CompletionMessage>(hubMessage); 267var completion = Assert.IsType<CompletionMessage>(hubMessage);
Internal\Protocol\NewtonsoftJsonHubProtocolTests.cs (1)
103new JsonProtocolTestData("CompletionMessage_HasFloatResult", CompletionMessage.WithResult("123", 2.0f), true, true, "{\"type\":3,\"invocationId\":\"123\",\"result\":2.0}"),
Internal\Protocol\TestBinder.cs (1)
29case CompletionMessage c:
Internal\Protocol\TestHubMessageEqualityComparer.cs (4)
31case CompletionMessage completionMessage: 32return CompletionMessagesEqual(completionMessage, (CompletionMessage)y); 51private bool CompletionMessagesEqual(CompletionMessage x, CompletionMessage y)
Microsoft.AspNetCore.SignalR.Core (21)
DefaultHubLifetimeManager.cs (1)
384public override Task SetConnectionResultAsync(string connectionId, CompletionMessage result)
HubLifetimeManager.cs (1)
158public virtual Task SetConnectionResultAsync(string connectionId, CompletionMessage result)
Internal\DefaultHubDispatcher.cs (10)
205case CompletionMessage completionMessage: 260var message = CompletionMessage.WithError(bindingFailureMessage.Id, errorString); 292return connection.WriteAsync(CompletionMessage.WithError( 445await connection.WriteAsync(CompletionMessage.WithResult(hubMethodInvocationMessage.InvocationId, result)); 499connection.StreamTracker.TryComplete(CompletionMessage.Empty(stream)); 602await connection.WriteAsync(CompletionMessage.WithError(invocationId, error)); 655await connection.WriteAsync(CompletionMessage.WithError(invocationId, errorMessage)); 699await connection.WriteAsync(CompletionMessage.WithError(hubMethodInvocationMessage.InvocationId, 709await connection.WriteAsync(CompletionMessage.WithError(hubMethodInvocationMessage.InvocationId!,
Internal\DefaultHubDispatcherLog.cs (2)
83public static void CompletingStream(ILogger logger, CompletionMessage message) 89public static void ClosingStreamWithBindingError(ILogger logger, CompletionMessage message)
src\SignalR\common\Shared\ClientResultsManager.cs (6)
16private readonly ConcurrentDictionary<string, (Type Type, string ConnectionId, object Tcs, Action<object, CompletionMessage> Complete)> _pendingInvocations = new(); 41public void AddInvocation(string invocationId, (Type Type, string ConnectionId, object Tcs, Action<object, CompletionMessage> Complete) invocationInfo) 48invocationInfo.Complete(invocationInfo.Tcs, CompletionMessage.WithError(invocationId, "ID collision occurred when using client results. This is likely a bug in SignalR.")); 52public void TryCompleteResult(string connectionId, CompletionMessage message) 75public (Type Type, string ConnectionId, object Tcs, Action<object, CompletionMessage> Completion)? RemoveInvocation(string invocationId) 152_clientResultsManager.TryCompleteResult(_connectionId, CompletionMessage.WithError(_invocationId, "Invocation canceled by the server."));
StreamTracker.cs (1)
74public bool TryComplete(CompletionMessage message)
Microsoft.AspNetCore.SignalR.Microbenchmarks (6)
DefaultHubDispatcherBenchmark.cs (5)
94if (message is CompletionMessage completionMessage) 346await _dispatcher.DispatchMessageAsync(_connectionContext, CompletionMessage.Empty("1")); 357await _dispatcher.DispatchMessageAsync(_connectionContext, CompletionMessage.Empty("1")); 371await _dispatcher.DispatchMessageAsync(_connectionContext, CompletionMessage.Empty("1")); 385await _dispatcher.DispatchMessageAsync(_connectionContext, CompletionMessage.Empty("1"));
TestBinder.cs (1)
26case CompletionMessage c:
Microsoft.AspNetCore.SignalR.Protocols.Json (2)
Protocol\JsonHubProtocol.cs (2)
541case CompletionMessage m: 592private void WriteCompletionMessage(CompletionMessage message, Utf8JsonWriter writer)
Microsoft.AspNetCore.SignalR.Protocols.MessagePack (3)
Protocol\MessagePackHubProtocolWorker.cs (3)
159private CompletionMessage CreateCompletionMessage(ref MessagePackReader reader, IInvocationBinder binder) 400case CompletionMessage completionMessage: 525private void WriteCompletionMessage(CompletionMessage message, ref MessagePackWriter writer)
Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson (2)
Protocol\NewtonsoftJsonHubProtocol.cs (2)
538case CompletionMessage m: 591private void WriteCompletionMessage(CompletionMessage message, JsonTextWriter writer)
Microsoft.AspNetCore.SignalR.Specification.Tests (15)
HubLifetimeManagerTestBase.cs (7)
194await manager.SetConnectionResultAsync(connection1.ConnectionId, CompletionMessage.WithResult(invocation.InvocationId, 10)).DefaultTimeout(); 221await manager.SetConnectionResultAsync(connection1.ConnectionId, CompletionMessage.WithError(invocation.InvocationId, "Error from client")).DefaultTimeout(); 252manager.SetConnectionResultAsync(connection2.ConnectionId, CompletionMessage.WithError(invocation.InvocationId, "Error from client"))).DefaultTimeout(); 257await manager.SetConnectionResultAsync(connection1.ConnectionId, CompletionMessage.WithResult(invocation.InvocationId, 10)).DefaultTimeout(); 307await manager1.SetConnectionResultAsync(connection2.ConnectionId, CompletionMessage.WithError(invocation2.InvocationId, "error")); 312await manager1.SetConnectionResultAsync(connection1.ConnectionId, CompletionMessage.WithResult(invocation1.InvocationId, 3)); 365await manager1.SetConnectionResultAsync(connection1.ConnectionId, CompletionMessage.WithResult(invocation1.InvocationId, 1));
ScaleoutHubLifetimeManagerTests.cs (5)
491await manager1.SetConnectionResultAsync(connection1.ConnectionId, CompletionMessage.WithResult(invocation.InvocationId, 10)).DefaultTimeout(); 522await manager1.SetConnectionResultAsync(connection1.ConnectionId, CompletionMessage.WithError(invocation.InvocationId, "Error from client")).DefaultTimeout(); 605await manager1.SetConnectionResultAsync(connection.ConnectionId, CompletionMessage.WithResult(invocation2.InvocationId, 2)).DefaultTimeout(); 606await manager2.SetConnectionResultAsync(connection.ConnectionId, CompletionMessage.WithResult(invocation1.InvocationId, 5)).DefaultTimeout(); 654await manager1.SetConnectionResultAsync(connection1.ConnectionId, CompletionMessage.WithResult(invocation.InvocationId, "wrong type")).DefaultTimeout();
src\SignalR\common\testassets\Tests.Utils\TestClient.cs (3)
139case CompletionMessage _: 149public async Task<CompletionMessage> InvokeAsync(string methodName, params object[] args) 171case CompletionMessage completion:
Microsoft.AspNetCore.SignalR.StackExchangeRedis (12)
RedisHubLifetimeManager.cs (6)
437public override Task SetConnectionResultAsync(string connectionId, CompletionMessage result) 573invocationInfo?.Completion(null!, CompletionMessage.WithError(invocation.InvocationId, "Connection disconnected.")); 701var invocationInfo = _clientResultsManager.RemoveInvocation(((CompletionMessage)hubMessage!).InvocationId!); 705hubMessage = CompletionMessage.WithError(((CompletionMessage)hubMessage!).InvocationId!, $"Client result wasn't deserializable to {invocationInfo?.Type.Name}."); 708invocationInfo?.Completion(invocationInfo?.Tcs!, (CompletionMessage)hubMessage!);
src\SignalR\common\Shared\ClientResultsManager.cs (6)
16private readonly ConcurrentDictionary<string, (Type Type, string ConnectionId, object Tcs, Action<object, CompletionMessage> Complete)> _pendingInvocations = new(); 41public void AddInvocation(string invocationId, (Type Type, string ConnectionId, object Tcs, Action<object, CompletionMessage> Complete) invocationInfo) 48invocationInfo.Complete(invocationInfo.Tcs, CompletionMessage.WithError(invocationId, "ID collision occurred when using client results. This is likely a bug in SignalR.")); 52public void TryCompleteResult(string connectionId, CompletionMessage message) 75public (Type Type, string ConnectionId, object Tcs, Action<object, CompletionMessage> Completion)? RemoveInvocation(string invocationId) 152_clientResultsManager.TryCompleteResult(_connectionId, CompletionMessage.WithError(_invocationId, "Invocation canceled by the server."));
Microsoft.AspNetCore.SignalR.Tests (186)
HubConnectionHandlerTests.Activity.cs (6)
59var completionMessage = Assert.IsType<CompletionMessage>(await client.ReadAsync().DefaultTimeout()); 67Assert.IsType<CompletionMessage>(await client.ReadAsync().DefaultTimeout()); 73Assert.IsType<CompletionMessage>(await client.ReadAsync().DefaultTimeout()); 141var completionMessage = Assert.IsType<CompletionMessage>(await client.ReadAsync().DefaultTimeout());
HubConnectionHandlerTests.ClientResult.cs (31)
31await client.SendHubMessageAsync(CompletionMessage.WithResult(invocationMessage.InvocationId, res)).DefaultTimeout(); 33var completion = Assert.IsType<CompletionMessage>(await client.ReadAsync().DefaultTimeout()); 63await client.SendHubMessageAsync(CompletionMessage.WithError(invocationMessage.InvocationId, "Client error")).DefaultTimeout(); 65var completion = Assert.IsType<CompletionMessage>(await client.ReadAsync().DefaultTimeout()); 155await client.SendHubMessageAsync(CompletionMessage.WithResult(invocation.InvocationId, 2)).DefaultTimeout(); 189await client.SendHubMessageAsync(CompletionMessage.WithResult(invocation.InvocationId, 2)).DefaultTimeout(); 220await client.SendHubMessageAsync(CompletionMessage.WithResult(invocationMessage.InvocationId, res)).DefaultTimeout(); 223var completion = Assert.IsType<CompletionMessage>(await client.ReadAsync().DefaultTimeout()); 261await client.SendHubMessageAsync(CompletionMessage.WithResult(invocationMessage.InvocationId, res)).DefaultTimeout(); 262var completion = Assert.IsType<CompletionMessage>(await client.ReadAsync().DefaultTimeout()); 267await client.SendHubMessageAsync(CompletionMessage.WithResult(invocationMessage2.InvocationId, res)).DefaultTimeout(); 268completion = Assert.IsType<CompletionMessage>(await client.ReadAsync().DefaultTimeout()); 273await client.SendHubMessageAsync(CompletionMessage.WithResult(invocationMessage3.InvocationId, res)).DefaultTimeout(); 274completion = Assert.IsType<CompletionMessage>(await client.ReadAsync().DefaultTimeout()); 297var completionMessage = await client.InvokeAsync(nameof(MethodHub.BackgroundClientResult)).DefaultTimeout(); 310await client.SendHubMessageAsync(CompletionMessage.WithResult(invocationMessage.InvocationId, res)).DefaultTimeout(); 388await client.SendHubMessageAsync(CompletionMessage.WithResult(invocation.InvocationId, 2)).DefaultTimeout(); 392var completion = await client.InvokeAsync(nameof(HubT.Echo), "test").DefaultTimeout(); 433await client.SendHubMessageAsync(CompletionMessage.WithResult(invocation.InvocationId, 2)).DefaultTimeout(); 437var completion = await client.InvokeAsync("Echo", "test").DefaultTimeout(); 468await client.SendHubMessageAsync(CompletionMessage.WithResult(invocationMessage.InvocationId, res)).DefaultTimeout(); 470var completion = Assert.IsType<CompletionMessage>(await client.ReadAsync().DefaultTimeout()); 475var completionMessage = await client.InvokeAsync(nameof(MethodHub.ValueMethod)).DefaultTimeout(); 503await client.SendHubMessageAsync(CompletionMessage.WithResult(invocationMessage.InvocationId, res)).DefaultTimeout(); 509var completionMessage = Assert.IsType<CompletionMessage>(await client.ReadAsync().DefaultTimeout());
HubConnectionHandlerTests.cs (124)
79var result = (await client.InvokeAsync(nameof(HubWithAsyncDisposable.Test)).DefaultTimeout()); 405var completionMessage = await task.DefaultTimeout() as CompletionMessage; 443var completionMessage = await client.ReadAsync() as CompletionMessage; 560var completionMessage = await client.ReadAsync().DefaultTimeout() as CompletionMessage; 565completionMessage = await client.ReadAsync().DefaultTimeout() as CompletionMessage; 611var completionMessage = await client.ReadAsync().DefaultTimeout() as CompletionMessage; 616completionMessage = await client.ReadAsync().DefaultTimeout() as CompletionMessage; 621completionMessage = await client.ReadAsync().DefaultTimeout() as CompletionMessage; 928var message = await client.InvokeAsync(methodName).DefaultTimeout(); 997var message = await client.InvokeAsync(methodName).DefaultTimeout(); 1240var result = await client.InvokeAsync(nameof(MethodHub.OnDisconnectedAsync)).DefaultTimeout(); 1284var result = await client.InvokeAsync(nameof(MethodHub.StaticMethod)).DefaultTimeout(); 1309var result = await client.InvokeAsync(nameof(MethodHub.ToString)).DefaultTimeout(); 1342var result = await client.InvokeAsync(nameof(MethodHub.Dispose)).DefaultTimeout(); 1467var completion = Assert.IsType<CompletionMessage>(firstClientResult); 1628Assert.IsType<CompletionMessage>(hubMessage); 1673Assert.IsType<CompletionMessage>(hubMessage); 1770Assert.IsType<CompletionMessage>(hubMessage); 1821Assert.IsType<CompletionMessage>(hubMessage); 2030HubConnectionHandlerTestUtils.AssertHubMessage(CompletionMessage.Empty(string.Empty), messages[4]); 2059var hubMessage = Assert.IsType<CompletionMessage>(await client.ReadAsync().DefaultTimeout()); 2105var completion = messages[0] as CompletionMessage; 2213var message = await client.InvokeAsync(nameof(MethodHub.AuthMethod)).DefaultTimeout(); 2250var message = await client.InvokeAsync(nameof(MethodHub.AuthMethod)).DefaultTimeout(); 2358var message = await client.InvokeAsync(nameof(MethodHub.MultiParamAuthMethod), "Hello", "World!").DefaultTimeout(); 2575Assert.IsType<CompletionMessage>(client2.TryRead()); 2680var completion = await client.InvokeAsync(nameof(MethodHub.ValueMethod)).DefaultTimeout(); 2925Assert.IsType<CompletionMessage>(result); 3192var completion = await client.InvokeAsync(nameof(StreamingHub.NonStream)).DefaultTimeout(); 3229var completion = messages[0] as CompletionMessage; 3264var completion = messages[0] as CompletionMessage; 3300var completion = Assert.IsType<CompletionMessage>(await client.ReadAsync().DefaultTimeout()); 3353var longRunningCompletion = Assert.IsType<CompletionMessage>(firstResult); 3359var simpleCompletion = Assert.IsType<CompletionMessage>(secondResult); 3405var simpleCompletion = Assert.IsType<CompletionMessage>(secondResult); 3415var longRunningCompletion = Assert.IsType<CompletionMessage>(firstResult); 3472var longRunningCompletion = Assert.IsType<CompletionMessage>(firstResult); 3478var simpleCompletion = Assert.IsType<CompletionMessage>(secondResult); 3485longRunningCompletion = Assert.IsType<CompletionMessage>(firstResult); 3525var completion = await client.InvokeAsync(nameof(LongRunningHub.SimpleMethod)).DefaultTimeout(); 3537completion = Assert.IsType<CompletionMessage>(await client.ReadAsync().DefaultTimeout()); 3612var result = (CompletionMessage)await client.ReadAsync().DefaultTimeout(5000); 3633await client.SendHubMessageAsync(CompletionMessage.Empty("id")).DefaultTimeout(); 3634var result = (CompletionMessage)await client.ReadAsync().DefaultTimeout(); 3657await client.SendHubMessageAsync(CompletionMessage.Empty("id")).DefaultTimeout(); 3658var response = (CompletionMessage)await client.ReadAsync().DefaultTimeout(); 3696await client.SendHubMessageAsync(CompletionMessage.Empty(id)).DefaultTimeout(); 3699Assert.Equal(words[int.Parse(id, CultureInfo.InvariantCulture)], ((CompletionMessage)response).Result); 3752await client.SendHubMessageAsync(CompletionMessage.Empty("id")).DefaultTimeout(); 3753var response = (CompletionMessage)await client.ReadAsync().DefaultTimeout(); 3780var completion = await client.InvokeAsync(nameof(LongRunningHub.SimpleMethod)).DefaultTimeout(); 3784await client.SendHubMessageAsync(CompletionMessage.Empty("id")).DefaultTimeout(); 3787var response = (CompletionMessage)await client.ReadAsync().DefaultTimeout(); 3879await client.SendHubMessageAsync(CompletionMessage.Empty("id")).DefaultTimeout(); 3880var response = (CompletionMessage)await client.ReadAsync().DefaultTimeout(); 3931Assert.Equal(typeof(CompletionMessage), response.GetType()); 3932Assert.Equal("error identified and caught", (string)((CompletionMessage)response).Result); 3976await client.SendHubMessageAsync(CompletionMessage.Empty("fake_id")).DefaultTimeout(); 4001await client.SendHubMessageAsync(CompletionMessage.WithError("id", CustomErrorMessage)).DefaultTimeout(); 4003var response = (CompletionMessage)await client.ReadAsync().DefaultTimeout(); 4022var response = (CompletionMessage)await client.ReadAsync().DefaultTimeout(); 4041var response = (CompletionMessage)await client.ReadAsync().DefaultTimeout(); 4066await client.SendHubMessageAsync(CompletionMessage.Empty("id")).DefaultTimeout(); 4069var simpleCompletion = Assert.IsType<CompletionMessage>(result); 4110await client.SendHubMessageAsync(CompletionMessage.Empty("id")).DefaultTimeout(); 4142var simpleCompletion = Assert.IsType<CompletionMessage>(result); 4179var simpleCompletion = Assert.IsType<CompletionMessage>(result); 4229var simpleCompletion = Assert.IsType<CompletionMessage>(result); 4392var completion = Assert.IsType<CompletionMessage>(await client.ReadAsync().DefaultTimeout()); 4428await client.SendHubMessageAsync(CompletionMessage.Empty(streamId)); 4494HubConnectionHandlerTestUtils.AssertHubMessage(CompletionMessage.Empty(string.Empty), messages[1]); 4661var res = await client.InvokeAsync(nameof(ServicesHub.SingleService)).DefaultTimeout(); 4678var res = await client.InvokeAsync(nameof(ServicesHub.SingleService)).DefaultTimeout(); 4697var res = await client.InvokeAsync(nameof(ServicesHub.MultipleServices)).DefaultTimeout(); 4721await client.SendHubMessageAsync(CompletionMessage.Empty("1")).DefaultTimeout(); 4723var response = Assert.IsType<CompletionMessage>(await client.ReadAsync().DefaultTimeout()); 4741var res = await client.InvokeAsync(nameof(ServicesHub.Stream)).DefaultTimeout(); 4763var res = await client.InvokeAsync(nameof(ServicesHub.ServiceWithoutAttribute)).DefaultTimeout(); 4784var res = await client.InvokeAsync(nameof(ServicesHub.ServiceWithoutAttribute)).DefaultTimeout(); 4805var res = await client.InvokeAsync(nameof(ServicesHub.IEnumerableOfServiceWithoutAttribute)).DefaultTimeout(); 4830var res = await client.InvokeAsync(nameof(ServicesHub.ServiceWithoutAttribute)).DefaultTimeout(); 4853var res = await client.InvokeAsync(nameof(ServicesHub.ServiceWithAndWithoutAttribute)).DefaultTimeout(); 4875var res = await client.InvokeAsync(nameof(ServicesHub.ServiceWithAndWithoutAttribute)).DefaultTimeout(); 4895var res = await client.InvokeAsync(nameof(ServicesHub.ServiceWithoutAttribute)).DefaultTimeout(); 4915var res = await client.InvokeAsync(nameof(ServicesHub.IEnumerableOfServiceWithoutAttribute)).DefaultTimeout(); 4938var res = await client.InvokeAsync(nameof(KeyedServicesHub.KeyedService)).DefaultTimeout(); 4961var res = await client.InvokeAsync(nameof(KeyedServicesHub.KeyedServiceWithParam), 91).DefaultTimeout(); 4985var res = await client.InvokeAsync(nameof(KeyedServicesHub.KeyedServiceNonKeyedService)).DefaultTimeout(); 5008var res = await client.InvokeAsync(nameof(KeyedServicesHub.MultipleKeyedServices)).DefaultTimeout(); 5031var res = await client.InvokeAsync(nameof(KeyedServicesHub.MultipleSameKeyedServices)).DefaultTimeout(); 5183var completionMessage = await client.InvokeAsync(nameof(MethodHub.Echo), new object[] { "test" }); 5220var completionMessage = Assert.IsType<CompletionMessage>(await readTask);
HubConnectionHandlerTestUtils\Utils.cs (3)
32case CompletionMessage expectedCompletion: 33var actualCompletion = Assert.IsType<CompletionMessage>(actual);
HubFilterTests.cs (18)
125var message = await client.InvokeAsync(nameof(MethodHub.Echo), "Hello world!").DefaultTimeout(); 161var completion = await client.InvokeAsync(nameof(DynamicTestHub.Echo), "hello"); 202var message = await client.InvokeAsync(nameof(MethodHub.Echo), "Hello world!").DefaultTimeout(); 252var message = await client.InvokeAsync(nameof(MethodHub.Echo), "Hello world!").DefaultTimeout(); 303var message = await client.InvokeAsync(nameof(MethodHub.Echo), "Hello world!").DefaultTimeout(); 361var message = await invokeTask.DefaultTimeout(); 421var message = await invokeTask.DefaultTimeout(); 483var message = await invokeTask.DefaultTimeout(); 551var message = await client.InvokeAsync(nameof(MethodHub.Echo), "Hello world!").DefaultTimeout(); 599var message = await client.InvokeAsync(nameof(MethodHub.Echo), "Hello world!").DefaultTimeout(); 638var message = await client.InvokeAsync("Method"); 669var message = await client.InvokeAsync("Method"); 700var message = await client.InvokeAsync(nameof(MethodHub.Echo), "Hello world!").DefaultTimeout(); 739var message = await client.InvokeAsync("Echo", "Hello"); 776var message = await client.InvokeAsync("Echo", "Hello"); 815var message = await client.InvokeAsync("Echo", "Hello"); 852var message = await client.InvokeAsync("Echo", "Hello"); 890var message = await client.InvokeAsync("Echo", "Hello");
Internal\MessageBufferTests.cs (4)
146Assert.True(messageBuffer.ShouldProcessMessage(CompletionMessage.WithResult("1", null))); 169Assert.False(messageBuffer.ShouldProcessMessage(CompletionMessage.WithResult("1", null))); 205await messageBuffer.WriteAsync(CompletionMessage.WithResult("1", null), default); 211Assert.IsType<CompletionMessage>(message);
Microsoft.AspNetCore.SignalR.Tests.Utils (3)
TestClient.cs (3)
139case CompletionMessage _: 149public async Task<CompletionMessage> InvokeAsync(string methodName, params object[] args) 171case CompletionMessage completion: