Esempio n. 1
0
        public void ShouldConnectToOpenFeed()
        {
            var subscriber = new BitfinexWebSocketSubscriber(_bitfinexExchangeConfiguration, false, _log);
            var gate       = new ManualResetEventSlim(false);
            var response   = "";

            subscriber.Subscribe(s =>
            {
                response = s;
                gate.Set();
                return(Task.CompletedTask);
            });

            subscriber.Start();


            var recieved = gate.Wait(TimeSpan.FromSeconds(10));

            Assert.True(recieved);
            Assert.Equal("{\"event\":\"info\",\"version\":1.1}", response);
        }
Esempio n. 2
0
        public void ShouldConnectToAuthFeed()
        {
            var subscriber = new BitfinexWebSocketSubscriber(_bitfinexExchangeConfiguration, true, _log);

            var gate     = new ManualResetEventSlim(false);
            var response = "";

            subscriber.Subscribe(s =>
            {
                response = s;
                gate.Set();
                return(Task.CompletedTask);
            });

            subscriber.Start();


            var recieved = gate.Wait(TimeSpan.FromSeconds(10));

            Assert.True(recieved);
            Assert.NotEqual("{\"event\":\"auth\",\"status\":\"FAILED\",\"chanId\":0,\"code\":10100,\"msg\":\"apikey: invalid\"}", response);
        }