public async Task CreateMovie_WhenAnExceptionIsThrownInTheDomainLayer_ShouldThrow() { // Arrange var expectedMessage = "Some Exception Message"; var expectedException = new DuplicateMovieException(expectedMessage); var moviesController = new MovieControllerForTest(expectedException); var movieResource = new MovieResource { Title = "Some Title", Genre = GenreParser.ToString(Genre.Action), ImageUrl = "Some Url", Year = 1900 }; // Act try { await moviesController.CreateMovie(movieResource); Assert.Fail("We were expecting an exception of type: DuplicateMovieException to be thrown, but no exception was thrown"); } catch (DuplicateMovieException e) { // Assert Assert.AreEqual(expectedMessage, e.Message); } }
public async Task CreateMovie_WhenProvidedWithAValidMovieResource_Succeeds() { // Arrange var movieResource = new MovieResource { Title = "Some Title", Genre = GenreParser.ToString(Genre.Action), ImageUrl = "Some Url", Year = 1900 }; var moviesController = new MovieControllerForTest(movies: null); // Act await moviesController.CreateMovie(movieResource); // Assert // Nothing to Assert Assert.IsTrue(true); }