public async Task Screening_sets_model_correctly( MovieDto movie, IFindMovieService serviceStub, [NoAutoProperties] MoviesController sut) { // Arrange Mock.Get(serviceStub) .Setup(x => x.FindMovie(movie.Id)) .ReturnsAsync(movie); // Act dynamic result = await sut.Screenings(serviceStub, movie.Id); // Assert object actual = result.Model; actual.Should().BeOfType <ScreeningsViewModel>(); actual.Should().BeEquivalentTo(new { MovieId = movie.Id, MovieTitle = movie.Title, Screenings = from s in movie.Screenings select ScreeningViewModel.Translate(s), }); }
public async Task <ActionResult> Screenings( [FromServices] IFindMovieService service, [FromRoute] Guid movieId) { MovieDto movie = await service.FindMovie(movieId); return(View(ScreeningsViewModel.Translate(movie))); }
public async Task Screening_returns_ViewResult( MovieDto movie, IFindMovieService serviceStub, [NoAutoProperties] MoviesController sut) { Mock.Get(serviceStub) .Setup(x => x.FindMovie(movie.Id)) .ReturnsAsync(movie); ActionResult actual = await sut.Screenings(serviceStub, movie.Id); actual.Should().BeOfType <ViewResult>(); }