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