示例#1
0
        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>());
        }
示例#2
0
        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);
        }
示例#3
0
        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);
        }