public async Task GetMovies_WhenThereAreNoExceptions_ReturnsAllMovies() { // Arrange var expectedMovies = RandomMovieGenerator.GenerateRandomMovies(50); var moviesController = new MovieControllerForTest(expectedMovies); // Act var actualMovieResources = await moviesController.GetMovies(); // Assert var actualMovies = MapToMvoies(actualMovieResources); MovieAssertions.AssertMoviesAreEqual(expectedMovies, actualMovies); }
public async Task GetMovies_WhenAnExceptionIsThrownInTheDomainLayer_ShouldThrow() { // Arrange var expectedMessage = "Some Exception Message"; var expectedException = new ConfigurationSettingMissingException(expectedMessage); var moviesController = new MovieControllerForTest(expectedException); // Act try { await moviesController.GetMovies(); Assert.Fail("We were expecting an exception of type: ConfigurationSettingMissingException to be thrown, but no exception was thrown"); } catch (ConfigurationSettingMissingException e) { // Assert Assert.AreEqual(expectedMessage, e.Message); } }