public void ThrowWhenArgumentMovieHasNullValue() { var mockedMovieRepo = new Mock <IRepository <Movie> >(); Movie nullMovie = null; var actualMoviesService = new Cinema.Data.Services.MoviesService(mockedMovieRepo.Object); Assert.That( () => actualMoviesService.Create(nullMovie), Throws.InstanceOf <ArgumentNullException>()); }
public void CallMoviesRepoSaveChangesMethod() { var mockedMovieRepo = new Mock <IRepository <Movie> >(); var mockedMovie = new Mock <Movie>(); var actualMoviesService = new Cinema.Data.Services.MoviesService(mockedMovieRepo.Object); actualMoviesService.Create(mockedMovie.Object); mockedMovieRepo.Verify( service => service.SaveChanges(), Times.Once); }
public void CallMoviesRepoAddMethodWithSameRecievedMovie() { var mockedMovieRepo = new Mock <IRepository <Movie> >(); var mockedMovie = new Mock <Movie>(); var actualMoviesService = new Cinema.Data.Services.MoviesService(mockedMovieRepo.Object); actualMoviesService.Create(mockedMovie.Object); mockedMovieRepo.Verify( service => service.Add(mockedMovie.Object), Times.Once); }