Example #1
0
        public void ItShouldReturnAllTheBeers(int?page, int?perPage)
        {
            var request = new GetAllBeersRequest
            {
                Page    = page,
                PerPage = perPage
            };

            var getAllBeersUseCase = new GetAllBeers(_catalog);

            getAllBeersUseCase.Execute(request, this);

            Assert.Equal(2, Response.Beers.Count);
        }
Example #2
0
        public ActionResult GetAllBeers([FromQuery] GetAllBeersRequest request)
        {
            var useCase = new GetAllBeers(_catalog);

            var presenter = new ApiGetAllBeersPresenter();

            useCase.Execute(request, presenter);

            var viewModel = presenter.ViewModel;

            if (viewModel.HttpCode == 200)
            {
                return(Ok(viewModel));
            }
            return(NoContent());
        }