public void GetAllMoviesWithTitleMatchingSearchTextTest()
        {
            //Arrange
            var seedDB = new List <MovieModelDAL>();
            var seed   = new MovieModelDAL
            {
                ID         = 5050,
                Title      = "Movie",
                Year       = 2018,
                Rated      = "10",
                Runtime    = "20 min",
                Genre      = "Commedy",
                Director   = "Director",
                Plot       = "Some Plot",
                Poster     = "www.poster.com",
                ImdbRating = 10f,
                ScreenShot = "www.screenshot.com"
            };

            seedDB.Add(seed);
            var controller = new MoviesLogic(new MovieDALStub(seedDB));
            var rightInput = "Movie";
            var wrongInput = "Not";
            //Act
            var result1 = controller.GetAllMoviesWithTitleMatchingSearchText(rightInput);
            var result2 = controller.GetAllMoviesWithTitleMatchingSearchText(wrongInput);

            //Assert
            Assert.IsTrue(result1.Count == 1);
            Assert.IsFalse(result2.Count > 0);
        }
        public void TestGetMovies()
        {
            //Arrange
            List <Movie> movies = new List <Movie>
            {
                new Movie(1, "Shrek", DateTime.Now, 2000, 67),
                new Movie(2, "Shrek 2", DateTime.Now, 2000, 87),
                new Movie(3, "Shrek 3", DateTime.Now, 2000, 57),
            };
            var Account = new Account
            {
                Name     = "Simon",
                Password = "******"
            };

            mock.Setup(x => x.GetMovies()).Returns(movies);
            MoviesLogic MoviesLogic = new MoviesLogic(mock.Object);


            var controllercontext = new Mock <HttpContext>();

            controllercontext.Setup(x => x.Session.GetObject <Account>("User")).Returns(Account);

            MoviesController controller = new MoviesController(MoviesLogic);

            controller.ControllerContext.HttpContext = controllercontext.Object;

            //Act
            ViewResult result    = controller.Index() as ViewResult;
            var        viewmodel = result.Model as MovieIndexViewModel;

            //Assert
            Assert.Equal(3, viewmodel.Movies.Count);
        }
        public void GetMoviesTest()
        {
            //Arrange
            var seedDB = new List <MovieModelDAL>();
            var seed   = new MovieModelDAL
            {
                ID         = 5050,
                Title      = "Movie",
                Year       = 2018,
                Rated      = "10",
                Runtime    = "20 min",
                Genre      = "Commedy",
                Director   = "Director",
                Plot       = "Some Plot",
                Poster     = "www.poster.com",
                ImdbRating = 10f,
                ScreenShot = "www.screenshot.com"
            };

            seedDB.Add(seed);
            var controller = new MoviesLogic(new MovieDALStub(seedDB));

            //Act
            var result1 = controller.GetMovies(true);

            //Assert
            Assert.IsTrue(result1.Result.Count == 1);
        }
        public void GetMovieTest()
        {
            //Arrange
            var seedDB = new List <MovieModelDAL>();
            var seed   = new MovieModelDAL
            {
                ID         = 5050,
                Title      = "Movie",
                Year       = 2018,
                Rated      = "10",
                Runtime    = "20 min",
                Genre      = "Commedy",
                Director   = "Director",
                Plot       = "Some Plot",
                Poster     = "www.poster.com",
                ImdbRating = 10f,
                ScreenShot = "www.screenshot.com"
            };

            seedDB.Add(seed);
            var controller = new MoviesLogic(new MovieDALStub(seedDB));
            var rightInput = 5050;
            var wrongInput = -10;

            //Act
            var result1 = controller.GetMovie(rightInput);
            var result2 = controller.GetMovie(wrongInput);

            //Assert
            Assert.IsNotNull(result1);
            Assert.IsNull(result2);
        }
        public MoviesControllerTests()
        {
            logicmock      = new Mock <IMoviesLogic>();
            sessionmock    = new Mock <IUserSession>();
            repositorymock = new Mock <IMoviesRepository>();

            MoviesLogic = new MoviesLogic(repositorymock.Object);
            account     = new Account();
            controller  = new MoviesController(logicmock.Object, sessionmock.Object);

            movies = new List <Movie>
            {
                new Movie(1, "Shrek", DateTime.Now, 2000, 67),
                new Movie(2, "Shrek 2", DateTime.Now, 2000, 87),
                new Movie(3, "Transformers", DateTime.Now, 2000, 57),
            };
        }
Example #6
0
 public RatingController(RatingLogic ratinglogic, MoviesLogic movielogic)
 {
     _ratinglogic = ratinglogic;
     _movielogic  = movielogic;
 }
Example #7
0
 public MoviesLogicTests()
 {
     repositorymock = new Mock <IMoviesRepository>();
     logic          = new MoviesLogic(repositorymock.Object);
 }
Example #8
0
 public MoviesOrderAdministrationController()
 {
     _movieOrdersLogic = new MovieOrdersLogic();
     _moviesLogic      = new MoviesLogic();
 }
Example #9
0
 public MyMoviesController()
 {
     _movieOrdersLogic = new MovieOrdersLogic();
     _moviesLogic      = new MoviesLogic();
 }
Example #10
0
 public MoviesController(MoviesLogic moviescontext)
 {
     _context = moviescontext;
 }
Example #11
0
        public ActionResult Edit(Movie movie)
        {
            var updated = MoviesLogic.Update(movie);

            return(View(updated));
        }
 public HomeController()
 {
     _moviesLogic        = new MoviesLogic();
     _customerUsersLogic = new CustomerUsersLogic();
     _movieOrdersLogic   = new MovieOrdersLogic();
 }
 public MoviesController(MoviesLogic movieService)
 => this._movieService = movieService;
Example #14
0
 public MoviesLogicTests()
 {
     _context = new Mock <IMoviesContext>();
     logic    = new MoviesLogic(_context.Object);
 }
Example #15
0
 /// <summary>
 /// Constructor to intialize objects.
 /// </summary>
 public MoviesAdministrationController()
 {
     _moviesLogic = new MoviesLogic();
 }