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