public async Task Websocket_stream_should_work_when_used_by_multiple_flows() { // Arrange _connectCallback = (source, sink) => { _fromClient2 = source.RunWith(this.SinkProbe <ISignalREvent>(), Sys.Materializer()); _toClient2 = sink.RunWith(this.SourceProbe <ISignalRResult>(), Sys.Materializer()); }; await ConnectAsync(msg => Log.Info(msg)); var data1 = _fromClient.RequestNext(); var data2 = _fromClient2.RequestNext(); data1.Should().BeOfType <Connected>(); data2.Should().BeOfType <Connected>(); await _connection.InvokeAsync(nameof(IServerSource.Send), "payload"); data1 = _fromClient.RequestNext(); data2 = _fromClient2.RequestNext(); data1.Should().BeOfType <Received>(); data2.Should().BeOfType <Received>(); ((Received)data1).Data.ToString().Should().Be("payload"); ((Received)data2).Data.ToString().Should().Be("payload"); }
public async Task Websocket_connection_should_be_able_to_receive_data() { // Arrange await ConnectAsync(msg => Log.Info(msg)); // Act await _connection.InvokeAsync(nameof(IServerSource.Send), "payload"); // Assert _fromClient.RequestNext().Should().BeOfType <Connected>(); var message = _fromClient.RequestNext(); message.Should().BeOfType <Received>(); ((Received)message).Data.ToString().Should().Be("payload"); }