Example #1
0
        public void Execute_ShouldThrowNullReferenceException_WhenNoMoviesAreReturnedFromDatabase()
        {
            var listByGenreCommand = new ListByGenreCommand(movieServiceMock.Object, tableCreatorMock.Object);

            movieServiceMock.Setup(x => x.GetMoviesByGenre("")).Returns((IEnumerable <Movie>)null);

            Assert.Throws <NullReferenceException>(() => listByGenreCommand.Execute(new List <string>()
            {
                ""
            }));
        }
Example #2
0
        public void Execute_ShouldReturnCorrectString()
        {
            var listByGenreCommand = new ListByGenreCommand(movieServiceMock.Object, tableCreatorMock.Object);
            var expectedResult     = "test string";

            movieServiceMock.Setup(x => x.GetMoviesByGenre("")).Returns(new List <Movie>());
            movieServiceMock.Setup(x => x.ConvertForPrint(new List <Movie>())).Returns(new List <MovieForPrint>());
            tableCreatorMock.Setup(x => x.CreateTable <MovieForPrint>(new List <MovieForPrint>())).Returns(expectedResult);

            var actualResult = listByGenreCommand.Execute(new List <string>()
            {
                ""
            });

            StringAssert.AreEqualIgnoringCase(expectedResult, actualResult);
        }