public void MoviesPageView_SecondPageRequestedWhenNoMoviesExist_RedirectsToIndex() { // Arrange using var target = new ConcreteMoviesController(Enumerable.Empty <string>(), 2); // Act var actionResult = target.InvokeMoviesPageView(2); // Assert var redirectPageNumber = ExtractRedirectPageNumber(actionResult); redirectPageNumber.Should().BeNull(); }
public void MoviesPageView_ZeroPageRequestedWhenTotalOnePage_RedirectsToIndex() { // Arrange using var target = new ConcreteMoviesController(new[] { "Movie 1" }, 2); // Act var actionResult = target.InvokeMoviesPageView(0); // Assert var redirectPageNumber = ExtractRedirectPageNumber(actionResult); redirectPageNumber.Should().BeNull(); }
public void MoviesPageView_ThirdPageRequestedWhenTotalTwoPages_RedirectsToSecondPage() { // Arrange using var target = new ConcreteMoviesController(new[] { "Movie 1", "Movie 2", "Movie 3" }, 2); // Act var actionResult = target.InvokeMoviesPageView(3); // Assert var redirectPageNumber = ExtractRedirectPageNumber(actionResult); redirectPageNumber.Should().Be(2); }
public void MoviesPageView_FirstPageRequestedWhenNoMoviesExist_ReturnsViewWithNoMovies() { // Arrange using var target = new ConcreteMoviesController(Enumerable.Empty <string>(), 2); // Act var actionResult = target.InvokeMoviesPageView(1); // Assert var expectedViewModel = new MoviesPageViewModel(Array.Empty <string>(), 1, 0); var viewModel = ExtractViewModel(actionResult); viewModel.Should().BeEquivalentTo(expectedViewModel, x => x.WithStrictOrdering()); }
public void MoviesPageView_ThirdPageRequestedWhenTotalThreePages_ReturnsCorrectMovies() { // Arrange using var target = new ConcreteMoviesController(new[] { "Movie 1", "Movie 2", "Movie 3", "Movie 4", "Movie 5" }, 2); // Act var actionResult = target.InvokeMoviesPageView(3); // Assert var expectedViewModel = new MoviesPageViewModel(new[] { "Movie 5" }, 3, 3); var viewModel = ExtractViewModel(actionResult); viewModel.Should().BeEquivalentTo(expectedViewModel, x => x.WithStrictOrdering()); }