public void movie_added_event_should_have_proper_path() { fakeMovie.Path = null; fakeMovie.RootFolderPath = @"C:\Test\Movies"; Mocker.GetMock <IBuildFileNames>() .Setup(s => s.GetMovieFolder(fakeMovie, null)) .Returns(fakeMovie.Title); var series = Subject.AddMovie(fakeMovie); series.Path.Should().NotBeNull(); }
public void should_have_proper_path() { var newMovie = new Movie { TmdbId = 1, RootFolderPath = @"C:\Test\Movies" }; GivenValidMovie(newMovie.TmdbId); GivenValidPath(); var series = Subject.AddMovie(newMovie); series.Path.Should().Be(Path.Combine(newMovie.RootFolderPath, _fakeMovie.Title)); }
public void should_be_able_to_add_a_movie_without_passing_in_title() { var newMovie = new Movie { TmdbId = 1, RootFolderPath = @"C:\Test\Movies" }; GivenValidMovie(newMovie.TmdbId); GivenValidPath(); var series = Subject.AddMovie(newMovie); series.Title.Should().Be(_fakeMovie.Title); }
public void should_throw_if_movie_validation_fails() { var newMovie = new Movie { TmdbId = 1, Path = @"C:\Test\Movie\Title1" }; GivenValidMovie(newMovie.TmdbId); Mocker.GetMock <IAddMovieValidator>() .Setup(s => s.Validate(It.IsAny <Movie>())) .Returns(new ValidationResult(new List <ValidationFailure> { new ValidationFailure("Path", "Test validation failure") })); Assert.Throws <ValidationException>(() => Subject.AddMovie(newMovie)); }
public void should_throw_if_movie_cannot_be_found() { var newMovie = new Movie { TmdbId = 1, Path = @"C:\Test\Movie\Title1" }; Mocker.GetMock <IProvideMovieInfo>() .Setup(s => s.GetMovieInfo(newMovie.TmdbId)) .Throws(new MovieNotFoundException("Movie Not Found")); Mocker.GetMock <IAddMovieValidator>() .Setup(s => s.Validate(It.IsAny <Movie>())) .Returns(new ValidationResult(new List <ValidationFailure> { new ValidationFailure("Path", "Test validation failure") })); Assert.Throws <ValidationException>(() => Subject.AddMovie(newMovie)); ExceptionVerification.ExpectedErrors(1); }