Exemplo n.º 1
0
        public void UpdateOrderBook_SecondUpdate()
        {
            // Arrange
            var exchangeApi     = ExchangeServiceHelper.GetExchangeService();
            var exchangeService = new WpfExchangeService(exchangeApi);

            var preferences = new Model.Preferences();

            preferences.OrderBookChartDisplayCount = 8;
            preferences.OrderBookDisplayCount      = 5;

            var symbolViewModel = new SymbolViewModel(exchangeService, chartHelper, preferences, new DebugLogger());

            var trx = TestHelper.Trx.GetViewSymbol();

            symbolViewModel.Symbol = trx;

            var firstOrderBook  = OrderBookUpdateHelper.OrderBook_Trx_GetFirstUpdate();
            var secondOrderBook = OrderBookUpdateHelper.OrderBook_Trx_GetSecondUpdate();

            // Act
            symbolViewModel.UpdateOrderBook(firstOrderBook);

            symbolViewModel.UpdateOrderBook(secondOrderBook);

            // Assert
            AssertOrderBookUpdate(symbolViewModel, secondOrderBook, preferences);
        }
Exemplo n.º 2
0
        public void UpdateOrderBook_SecondUpdate()
        {
            // Arrange
            var exchangeApi     = ExchangeServiceHelper.GetExchangeService();
            var exchangeService = new WpfExchangeService(exchangeApi);

            var preferences = new Model.Preferences
            {
                OrderBookChartDisplayCount = 8,
                OrderBookDisplayCount      = 5
            };

            var symbolViewModel = new SymbolViewModel(Exchange.Test, exchangeService, chartHelper,
                                                      new BinanceOrderBookHelper(),
                                                      new TradeHelper(),
                                                      preferences, new DebugLogger());

            var trx = TestHelper.Trx.GetViewSymbol();

            symbolViewModel.Symbol = trx;

            var orderBook       = new OrderBookUpdateHelper();
            var firstOrderBook  = orderBook.OrderBook_Trx_GetFirstUpdate();
            var secondOrderBook = orderBook.OrderBook_Trx_GetSecondUpdate();

            // AppVeyor Hack!!!
            if (firstOrderBook.LastUpdateId.Equals(secondOrderBook.LastUpdateId))
            {
                secondOrderBook.LastUpdateId++;
            }

            // Act
            symbolViewModel.UpdateOrderBook(firstOrderBook);

            symbolViewModel.UpdateOrderBook(secondOrderBook);

            // Assert
            AssertOrderBookUpdate(symbolViewModel, secondOrderBook, preferences);
        }