コード例 #1
0
        public void Orderline_properties_set_ok_test()
        {
            Orderline orderline = new Orderline();
            Movie movie = new Movie() { MovieId = 1, Title = "Smurfs" };
            orderline.Movie = movie;
            orderline.Amount = 10;

            Assert.AreEqual(movie, orderline.Movie);
            Assert.AreEqual(10, orderline.Amount);
        }
コード例 #2
0
        public ActionResult Complete()
        {
            CustomerCart cc = (CustomerCart)Session["cont"];

            Order order = new Order { CustomerId = cc.Customer.CustomerId, Date = DateTime.Now };

            df.OrderRepository.Add(order);
            //List<Order> orders = df.OrderRepository.GetAll().ToList();
            //Order finalOrder = orders.FindLast(o);
            foreach(ShoppingCartItem item in cc.CartItems.ToList())
            {
                Orderline ol = new Orderline { Amount = item.Quantity, MovieId = item.MovieId, OrderId = order.OrderId };
                df.OrderlineRepository.Add(ol);

            }
            Session["cart"] = null;
            return View();
        }
コード例 #3
0
 public void Orderline_amount_less_than_one_fails_test()
 {
     Orderline orderline = new Orderline();
     orderline.Amount = -1;
 }