-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathBitfinexWebsocketCommunicatorTests.cs
More file actions
35 lines (30 loc) · 1 KB
/
Copy pathBitfinexWebsocketCommunicatorTests.cs
File metadata and controls
35 lines (30 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using System;
using System.Threading;
using System.Threading.Tasks;
using Bitfinex.Client.Websocket.Websockets;
using Xunit;
namespace Bitfinex.Client.Websocket.Tests.Integration
{
public class BitfinexWebsocketCommunicatorTests
{
[Fact]
public async Task OnStarting_ShouldGetInfoResponse()
{
var url = BitfinexValues.ApiWebsocketUrl;
using (var communicator = new BitfinexWebsocketCommunicator(url))
{
string received = null;
var receivedEvent = new ManualResetEvent(false);
communicator.MessageReceived.Subscribe(msg =>
{
received = msg.Text;
receivedEvent.Set();
});
await communicator.Start();
receivedEvent.WaitOne(TimeSpan.FromSeconds(30));
Assert.NotNull(received);
Assert.Contains("\"event\":\"info\",\"version\":2", received);
}
}
}
}