public ActionResult Index()
 {
     Facade fac = new Facade();
     Movie mov = new Movie() { ID = 1, Title = "Title", price = 2020, Year = DateTime.Now };
     fac.GetMovieRepository().Add(mov);
     return View(fac.GetMovieRepository().GetAllMovies());
 }
        public void Test_Add_ShoppingCart()
        {
            ShoppingCart cart = new ShoppingCart();
            Orderline OL = new Orderline();
            Movie mov = new Movie() { Id = 1, Title = "Avengers: Age Of Ultron", Genre = new Genre() { Id = 2, Name = "Action" }, Price = 150, Year = DateTime.Now, ImgUrl = "http://scaled.ysimag.es/movie/the-avengers-age-of-ultron", TrailerUrl = "https://www.youtube.com/watch?v=S2HIda5wSVU" };
            Customer cust = new Customer()
            {
                Id = 1,
                FirstName = "Someone",
                MiddleName = "Else",
                LastName = "Name",
                Email = "*****@*****.**",
                StreetName = "Bla Vej",
                StreetNumber = 1,
                Password = "******"
            };

            OL.Movie = mov;
            OL.Amount = 3;
            cust.Id = 1;

            cart.CustomerId = 1;
            cart.Orderline.Add(OL);

            Assert.AreEqual(cart.CustomerId,1);
            Assert.AreEqual(cust.Id, 1);
            Assert.AreEqual(cart.Orderline.First(), OL, "The movies should be equal");
        }
 public ActionResult Edit(Movie movie)
 {
     //METHOD NAME MIGHT CHANGE.
         movie.Genre = facade.GetGenreGateway().Get(movie.Genre.Id);
     //METHOD NAME MIGHT CHANGE.
     facade.GetMovieGateway().Update(movie);
     return Redirect("Index");
 }
 public ActionResult Create(Movie movie)
 {
     //[Bind(Include = "Title, Price, Year, Genre.Id, ImgUrl, TrailerUrl")]
     //METHOD NAME MIGHT CHANGE.
     movie.Genre = facade.GetGenreGateway().Get(movie.Genre.Id);
     facade.GetMovieGateway().Add(movie);
     return Redirect("Index");
 }
 public void Add(Movie movie)
 {
     using(var ctx = new MovieShopContext())
     {
         ctx.Movies.Add(movie);
         ctx.SaveChanges();
     }
 }
        public void Amount_Out_Of_Range()
        {
            Movie mov = new Movie() { Id = 1, Title = "Avengers: Age Of Ultron", Genre = new Genre() { Id = 2, Name = "Action" }, Price = 150, Year = DateTime.Now, ImgUrl = "http://scaled.ysimag.es/movie/the-avengers-age-of-ultron", TrailerUrl = "https://www.youtube.com/watch?v=S2HIda5wSVU" };

            Orderline OL = new Orderline();

            OL.Movie = mov;

            Assert.Throws<IndexOutOfRangeException>(() => OL.Amount = 11);
        }
        public void TestGetters()
        {
            Movie mov = new Movie() { Id = 1, Title = "Avengers: Age Of Ultron", Genre = new Genre() { Id = 2, Name = "Action" }, Price = 150, Year = DateTime.Now, ImgUrl = "http://scaled.ysimag.es/movie/the-avengers-age-of-ultron", TrailerUrl = "https://www.youtube.com/watch?v=S2HIda5wSVU" };

            Orderline OL = new Orderline();
            OL.MovieId = 1;
            OL.OrderId = 2;
            OL.Price = 150;
            OL.Id = 2;
            OL.Movie = mov;
            OL.Amount = 3;

            Assert.AreEqual(OL.Id, 2);
            Assert.AreEqual(OL.MovieId, 1);
            Assert.AreEqual(OL.OrderId, 2);
            Assert.AreEqual(OL.Price, 150);
            Assert.AreEqual(OL.Movie, mov, "The movies should be equal");
            Assert.AreEqual(OL.Amount, 3, "The amount should be equal");
        }
        public void Test_Getters_And_Setters()
        {
            Movie mov = new Movie() { Id = 1, Title = "Avengers: Age Of Ultron", Genre = new Genre() { Id = 2, Name = "Action" }, Price = 150, Year = DateTime.Now.Date, ImgUrl = "http://scaled.ysimag.es/movie/the-avengers-age-of-ultron", TrailerUrl = "https://www.youtube.com/watch?v=S2HIda5wSVU" };
            mov.Id = 1;
            mov.Title = "Avengers: Age Of Ultron";
            mov.Genre.Id = 2;
            mov.Genre.Name = "Action";
            mov.Price = 150;
            mov.ImgUrl = "http://scaled.ysimag.es/movie/the-avengers-age-of-ultron";
            mov.TrailerUrl = "https://www.youtube.com/watch?v=S2HIda5wSVU";
            mov.Year= DateTime.Now.Date;

            Assert.AreEqual(mov.Id,1);
            Assert.AreEqual(mov.Title, "Avengers: Age Of Ultron");
            Assert.AreEqual(mov.Genre.Id,2);
            Assert.AreEqual(mov.Genre.Name,"Action");
            Assert.AreEqual(mov.Price,150);
            Assert.AreEqual(mov.ImgUrl,"http://scaled.ysimag.es/movie/the-avengers-age-of-ultron");
            Assert.AreEqual(mov.TrailerUrl, "https://www.youtube.com/watch?v=S2HIda5wSVU");
            Assert.AreEqual(mov.Year,DateTime.Now.Date);
        }
 private void GetMovie(int Id)
 {
     Movie = facade.GetMovieGateway().Get(Id);
 }
 static void Main(string[] args)
 {
     Movie mov = new Movie() { ID = 1, Title = "Title", price = 2020, Year = DateTime.Now };
     Facade fac = new Facade();
     fac.GetMovieRepository().Add(mov);
 }