Beispiel #1
0
        public void Should_AddAnMovie_WhenAddingAnMovie()
        {
            //Arrange
            MovieModel movie = new MovieModel {
                Id = 10, Name = "AddTest"
            };

            //Act
            movieLogic.AddMovie(movie);

            //Assert
            Assert.True(movieLogic.GetMovieById(10).Name == "AddTest");
        }
        public IActionResult AddMovie([Bind("Title, PublishedYear, MoviePrice")] Movie movie)
        {
            if (ModelState.IsValid)
            {
                if (_movieLogic.CheckIfMovieExists(movie))
                {
                    _movieLogic.AddMovie(movie);
                }
                else
                {
                    TempData["alertMessage"] = "Movie does not exist!";
                }
            }

            return(View("AddMovie", new Movie()));
        }