public void Test_GetCheapestMoviesFromApi_Returns_MovieDTO_NoException_EmptyList() { // Arrange var mockRepo = new Mock <IMovieProvider>(); mockRepo.Setup(repo => repo.GetAllMoviesFromApi("cinemaworld", true)).ReturnsAsync(ListClasses.GetMockEmptyMovies()); var controller = new MovieController(mockRepo.Object); // Act var random = controller.GetCheapestMoviesFromApi("cinemaworld"); var c = random.ToList().Count; //Assert Assert.True(random.ToList().Count == 0); try { Assert.Throws <InvalidOperationException>(() => controller.GetCheapestMoviesFromApi("cinemaworld")); } catch (AssertActualExpectedException exception) { Assert.Equal("(No exception was thrown)", exception.Actual); } }
public void Test_GetCheapestMoviesFromApi_Returns_MovieDTO_FilmWorld() { // Arrange var mockRepo = new Mock <IMovieProvider>(); mockRepo.Setup(repo => repo.GetAllMoviesFromApi("filmworld", true)).ReturnsAsync(ListClasses.GetMockMovies()); var controller = new MovieController(mockRepo.Object); // Act var film = controller.GetCheapestMoviesFromApi("filmworld"); var c = film.ToList().Count; //Assert Assert.IsAssignableFrom <IEnumerable <MovieDTO> >(film); Assert.NotNull(film); Assert.True(film.ToList().Count != 0); }