Пример #1
0
        public void HandleResponse_Subscribed_StreamUpdated()
        {
            // Arrange
            var timestamp = DateTimeOffset.UtcNow;
            var triggered = false;
            var client    = InitializeMarketClient();

            client.Streams.SubscribeResponseStream.Subscribe(
                msg =>
            {
                triggered = true;

                // Assert
                Assert.NotNull(msg);
                Assert.True(!string.IsNullOrEmpty(msg.Topic));
                Assert.True(!string.IsNullOrEmpty(msg.Status));
                Assert.True(!string.IsNullOrEmpty(msg.ReqId));
                Assert.True(TestUtils.UnixTimesEqual(timestamp, msg.Timestamp));
            });

            var message = HuobiMessagesFactory.CreateSubscribeResponseMessage(timestamp);

            // Act
            TriggerMessageReceive(message);

            // Assert
            VerifyMessageNotUnhandled();
            Assert.True(triggered);
        }
Пример #2
0
        public void HandleResponse_StreamUpdated()
        {
            // Arrange
            var timestamp = DateTimeOffset.UtcNow;
            var message   = HuobiMessagesFactory.CreateSubscribeResponseMessage(timestamp);

            var triggered = false;
            var client    = InitializeGenericClient();

            client.Streams.ResponseMessageStream.Subscribe(
                msg =>
            {
                triggered = true;

                // Assert
                Assert.Equal(message, msg);
            });

            // Act
            TriggerMessageReceive(message);

            // Assert
            VerifyMessageNotUnhandled();
            Assert.True(triggered);
        }