Esempio n. 1
0
        public async void ShouldContainSomeReferenceData()
        {
            var pass = false;
            var timeoutCancellationTokenSource = new CancellationTokenSource();

            var broker = new TestBroker();

            await broker.RpcCall <CurrencyPairUpdatesDto, NothingDto>(ServiceTypes.Reference, "getCurrencyPairUpdatesStream", new NothingDto(), dto =>
            {
                foreach (var x in dto.Updates)
                {
                    Console.WriteLine(x);
                }

                pass = true;
                timeoutCancellationTokenSource.Cancel(false);
            });

            try
            {
                await Task.Delay(ResponseTimeout, timeoutCancellationTokenSource.Token);

                _testOutputHelper.WriteLine($"Test timed out after {ResponseTimeout.TotalSeconds} seconds");
            }
            catch (TaskCanceledException)
            {
            }

            Assert.True(pass);
        }
Esempio n. 2
0
        public async void ShouldReceiveHeartbeatForServices(string serviceType)
        {
            var broker = new TestBroker();

            var heartbeat = await broker.SubscribeToTopic <dynamic>("status")
                            .Where(hb => hb.Type == serviceType)
                            .Timeout(TimeSpan.FromSeconds(10))
                            .Take(1);

            Assert.NotNull(heartbeat.Instance);
        }
Esempio n. 3
0
        public ExecuteTradeIntegrationTests()
        {
            var broker = new TestBroker();

            _channel = broker.OpenChannel().Result;

            _heartbeatStream = _channel.RealmProxy.Services.GetSubject <dynamic>("status")
                               .Publish()
                               .RefCount();

            _executionServiceInstance = GetInstanceName(ServiceTypes.Execution).Result;
        }
        public ExecuteTradeIntegrationTests()
        {
            var broker = new TestBroker();
            _channel = broker.OpenChannel().Result;

            _heartbeatStream = _channel.RealmProxy.Services.GetSubject<dynamic>("status")
                                       .Publish()
                                       .RefCount();

            _executionServiceInstance = _heartbeatStream
                .Where(hb => hb.Type == ServiceTypes.Execution)
                .Select(hb => hb.Instance)
                .Take(1)
                .Timeout(ResponseTimeout)
                .ToTask()
                .Result;

            _timeoutCancellationTokenSource = new CancellationTokenSource();
        }
Esempio n. 5
0
        public ExecuteTradeIntegrationTests()
        {
            var broker = new TestBroker();

            _channel = broker.OpenChannel().Result;

            _heartbeatStream = _channel.RealmProxy.Services.GetSubject <dynamic>("status")
                               .Publish()
                               .RefCount();

            _executionServiceInstance = _heartbeatStream
                                        .Where(hb => hb.Type == ServiceTypes.Execution)
                                        .Select(hb => hb.Instance)
                                        .Take(1)
                                        .Timeout(ResponseTimeout)
                                        .ToTask()
                                        .Result;

            _timeoutCancellationTokenSource = new CancellationTokenSource();
        }
Esempio n. 6
0
 public ExecuteTradeIntegrationTests()
 {
     _broker = new TestBroker();
 }