public async Task <IActionResult> GetRandom()
        {
            var cocktail = await _dbApi.GetRandom();;
            var dto      = _mapper.Map <Cocktail>(cocktail);

            return(Ok(dto));
        }
Пример #2
0
        public async Task GetRandonCocktail()
        {
            var fakeHttpClient = new HttpClient(_infrastructure.OkRandomdRequestHandler);

            _infrastructure.MockHttpClientFactory.CreateClient().Returns(fakeHttpClient);
            var db = new DBApi(_infrastructure.MockHttpClientFactory, _fakeurl);

            var cocktail = await db.GetRandom();

            Assert.Equal("Margarita", cocktail.Drinks.First().StrDrink);
        }