Beispiel #1
0
        public async Task Get_statusOk()
        {
            //Arrange
            var httpResponseMessage = new HttpResponseMessageBuilder().StatusOk_Orderbook().Build();

            _httpRequestHandlerMock.Setup(p => p.Get(It.IsAny <string>())).ReturnsAsync(httpResponseMessage);

            OrderbookGetRequest orderbookGetRequest = new OrderbookGetRequest()
            {
                Coins = CoinsEnum.BTC
            };

            //Act
            var result = await _orderbookController.Get(orderbookGetRequest);

            var okObjectResult = result as OkObjectResult;
            var resultObj      = okObjectResult.Value as Orderbook;

            //Assert
            Assert.Equal(200, okObjectResult.StatusCode);
            Assert.NotNull(resultObj);
            Assert.Equal(3, resultObj.Asks.Count);
            Assert.Equal(2, resultObj.Bids.Count);
        }
Beispiel #2
0
        public async Task Get()
        {
            //Arrange
            _orderbookService.Setup(p => p.Get(It.IsAny <service.OrderbookGetRequest>())).ReturnsAsync(new service.Orderbook
            {
                Asks = new List <List <double> >
                {
                    new List <double>
                    {
                        25, 32
                    }
                },
                Bids = new List <List <double> >
                {
                    new List <double>
                    {
                        25, 32, 25
                    }
                }
            });

            api.OrderbookGetRequest tickerGetRequest = new api.OrderbookGetRequest()
            {
                Coins = CoinsEnum.BTC
            };

            //Act
            var result = await _orderbookController.Get(tickerGetRequest);

            var okObjectResult = result as OkObjectResult;
            var resultObj      = okObjectResult.Value as api.Orderbook;

            //Assert
            Assert.Equal(200, okObjectResult.StatusCode);
            Assert.NotNull(resultObj);
            Assert.Single(resultObj.Asks);
            Assert.Single(resultObj.Bids);
        }