Exemplo n.º 1
0
        public void get_movies_test(bool isMoviesFound)
        {
            _mockFacade.Setup(mock => mock.GetMovies())
            .Returns
            (
                new ResponseBag <IList <Movie> >
            {
                ObjectResponse = isMoviesFound
                        ? new List <Movie> {
                    new Movie()
                }
                        : new List <Movie>()
            }
            );

            var response = _controller.GetMovies();

            if (isMoviesFound)
            {
                Assert.IsType <OkObjectResult>(response);
            }
            else
            {
                Assert.IsType <NotFoundResult>(response);
            }

            _mockFacade.Verify(mock => mock.GetMovies(), Times.Once);
        }