Example #1
0
        public void AddOneMovie_ThrowsException()
        {
            var movie = new Movie
            {
            };

            var exception = ExceptionAssert.Throws<MoviesServiceException>(
                () => _moviesService.Create(movie));

            Assert.IsTrue(exception.Message.Contains("Movie Title is mandatory"));
        }
Example #2
0
 public ActionResult Create(Movie Model)
 {
     if(this.ModelState.IsValid)
     {
         this.MoviesService.Create(Model);
         return this.RedirectToAction("Index");
     }
     else
     {
         return View(Model); 
     }
 }
Example #3
0
        public void AddOneMovie()
        {
            var movie = new Movie
            {
                Title = "Movie title",
                Rating = 1,
                ReleaseDate = 2000
            };

            var movieId = _moviesService.Create(movie);
            var movieJustAdd = _moviesService.Get(movieId);

            Assert.IsTrue(movieJustAdd != null);
        }
Example #4
0
        public int Create(Movie movie)
        {
            _logProvider.LogDebug("Enter MoviesService.Create()" );

            try
            {
                var movieId = _moviesRepository.Insert(movie);
                ClearCache();

                return movieId;
            }
            catch (Exception ex)
            {
                _logProvider.LogException(ex);
                throw new MoviesServiceException(ex.Message);
            }
        }
Example #5
0
        public void UpdateMovie_ThrowsException()
        {
            var movie = new Movie
            {
                MovieId = 99999999,
                Title = "Updated Movie title",
            };

            var exception = ExceptionAssert.Throws<MoviesServiceException>(
                () => _moviesService.Update(movie));

            Assert.IsTrue(exception.Message.Contains("The movie ID 99999999 does not exist"));
        }
Example #6
0
        public void Update(Movie movie)
        {
            var movieData = Mapper.Map<Movie, MovieData>(movie);

            Database.Update(movieData);
        }
Example #7
0
        public int Insert(Movie movie)
        {
            var movieData = Mapper.Map<Movie, MovieData>(movie);

            return Database.Create(movieData);
        }
Example #8
0
 public void Update(Movie movie)
 {
     _moviesService.Update(movie);
 }
Example #9
0
 public int Create(Movie movie)
 {
     return _moviesService.Create(movie);
 }
Example #10
0
        public void Update(Movie movie)
        {
            _logProvider.LogDebug("Enter MoviesService.Update()");

            try
            {
               _moviesRepository.Update(movie);
                ClearCache();
            }
            catch (Exception ex)
            {
                _logProvider.LogException(ex);
                throw new MoviesServiceException(ex.Message);
            }
        }