public async Task <ActionResult> Get(OrderbookGetRequest request) { var serviceRequest = _mapper.Map <service.OrderbookGetRequest>(request); var orderbookServiceResp = await _orderbookService.Get(serviceRequest); var resp = _mapper.Map <Orderbook>(orderbookServiceResp); return(Ok(resp)); }
public async Task <Orderbook> Get(OrderbookGetRequest request) { var url = new Utils().BuildUrl(_url, request.Coins.ToString(), METHOD); var resp = await _httpRequestHandler.Get(url); var respDeserilized = JsonConvert.DeserializeObject <Orderbook>(await resp.Content.ReadAsStringAsync()); return(respDeserilized); }
public async Task Get_StatusOk_empty() { //Arrange var httpResponseMessage = new HttpResponseMessageBuilder().StatusOkEmpty().Build(); _httpRequestHandlerMock.Setup(p => p.Get(It.IsAny <string>())).ReturnsAsync(httpResponseMessage); OrderbookGetRequest orderbookGetRequest = new OrderbookGetRequest { Coins = CoinsEnum.BTC }; //Act var resp = await _orderbookService.Get(orderbookGetRequest); //Assert Assert.Null(resp); }
public async Task Get_statusOk_empty() { //Arrange var httpResponseMessage = new HttpResponseMessageBuilder().StatusOkEmpty().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.Null(resultObj); }