public void Execute_ShouldThrowNullReferenceException_WhenNoMoviesAreReturnedFromDatabase() { var listByStarCommand = new ListByStarCommand(movieServiceMock.Object, tableCreatorMock.Object); movieServiceMock.Setup(x => x.GetMoviesByStar("")).Returns((IEnumerable <Movie>)null); Assert.Throws <NullReferenceException>(() => listByStarCommand.Execute(new List <string>() { "" })); }
public void Execute_ShouldReturnCorrectString() { var listByStarCommand = new ListByStarCommand(movieServiceMock.Object, tableCreatorMock.Object); var expectedResult = "test string"; movieServiceMock.Setup(x => x.GetMoviesByStar("")).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 = listByStarCommand.Execute(new List <string>()); StringAssert.AreEqualIgnoringCase(expectedResult, actualResult); }