public async Task HandleCombinedStreamData() { var message = $"{{\"stream\":\"{_streamName}\",\"data\":{_message}}}"; var stream = new BinanceWebSocketStream(DefaultWebSocketClientTest.CreateMockWebSocketClient(message)) { Uri = _uri // NOTE: Processing of combined stream data is not dependant upon URI. }; var isMessageEventReceived = false; using (var cts = new CancellationTokenSource(TimeSpan.FromSeconds(3))) { stream.Message += (s, e) => { isMessageEventReceived = e.Subject == _streamName && e.Json == _message; }; Assert.False(isMessageEventReceived); await stream.StreamAsync(cts.Token); Assert.True(isMessageEventReceived); } }
public BinanceWebSocketStreamTest() { _uri = BinanceWebSocketStream.CreateUri(_streamName); _stream = new BinanceWebSocketStream(DefaultWebSocketClientTest.CreateMockWebSocketClient(_message)); }
public WebSocketStreamTest() { _uri = new Uri(BinanceWebSocketStream.BaseUri); _subject = _uri.AbsoluteUri; _stream = new WebSocketStream(DefaultWebSocketClientTest.CreateMockWebSocketClient(_message)); }