AyCode.Core/AyCode.Services.Server.Tests/SignalRs/TestInvocationBinder.cs

22 lines
805 B
C#

using AyCode.Services.SignalRs;
using Microsoft.AspNetCore.SignalR;
using Microsoft.AspNetCore.SignalR.Protocol;
namespace AyCode.Services.Server.Tests.SignalRs;
/// <summary>
/// Test IInvocationBinder that returns OnReceiveMessage parameter types
/// for protocol deserialization: (int messageTag, int? requestId, SignalParams signalParams, object data).
/// </summary>
internal class TestInvocationBinder : IInvocationBinder
{
private static readonly Type[] OnReceiveMessageTypes =
[typeof(int), typeof(int?), typeof(SignalParams), typeof(object)];
public IReadOnlyList<Type> GetParameterTypes(string methodName) => OnReceiveMessageTypes;
public Type GetReturnType(string invocationId) => typeof(object);
public Type GetStreamItemType(string streamId) => typeof(object);
}