public async void ClientConnectCallsBackplaneOnClientConnected() { var backplane = new TestBackplane(); var serviceProvider = CreateServiceProvider(o => { o.AddSingleton <IBackplane>(backplane); }); var actualHub = serviceProvider.GetRequiredService <HubWebSocketHandler <TestHub> >(); var webSocket = new LinkedFakeSocket(); var exception = await Assert.ThrowsAnyAsync <NotImplementedException>( () => CreateHubConnectionFromSocket(actualHub, webSocket)); Assert.Equal(nameof(TestBackplane.OnClientConnectedAsync), exception.Message); }
public async void SendMessageAllInvokesBackplaneSendMessageAll(MessageType type, string message) { var backplane = new TestBackplane(); var serviceProvider = CreateServiceProvider(o => { o.AddSingleton <IBackplane>(_ => backplane); }); var clientDispatcher = ActivatorUtilities.CreateInstance <ClientsDispatcher>(serviceProvider); var exception = await Assert.ThrowsAnyAsync <NotImplementedException>(() => clientDispatcher.All.SendMessageAsync(new Message { MessageType = type, Data = message })); Assert.Equal(message, exception.Message); }
public async void InvokeMethodInvokesBackplaneSendMessage(string connectionId, string methodName, params object[] arguments) { var backplane = new TestBackplane(); var serviceProvider = CreateServiceProvider(o => { o.AddSingleton <IBackplane>(_ => backplane); }); var clientDispatcher = ActivatorUtilities.CreateInstance <ClientsDispatcher>(serviceProvider); var exception = await Assert.ThrowsAnyAsync <NotImplementedException>( () => clientDispatcher.Client(connectionId).InvokeAsync(methodName, arguments)); Assert.Equal(connectionId + MessageSerializer.SerializeObject <InvocationDescriptor>(new InvocationDescriptor { MethodName = methodName, Arguments = arguments }), exception.Message); }