public async Task TestControllerCall_BestStories()
        {
            var totalStories = 20;
            await controller.BestStories(totalStories);

            A.CallTo(() => service.BestStories(totalStories)).MustHaveHappened();
        }
예제 #2
0
        public async Task <IActionResult> BestStories(int totalStories = 20)
        {
            try
            {
                var stories = await _iIHackerNewsService.BestStories(totalStories);

                return(Ok(stories));
            }
            catch (HttpResponseException ex)
            {
                return(StatusCode((int)ex.Status, ex.Message));
            }
            catch (Exception)
            {
                return(StatusCode(500));
            }
        }