Esempio n. 1
0
        public void TestAddProduct()
        {
            var userId = Guid.NewGuid();
            Product p = new Product();
            Cart cart = new Cart(userId);

            cart.AddProduct(p, 10);

            Assert.AreEqual(10, cart.Items[p.Id]);
        }
Esempio n. 2
0
        public void TestSubmitOrder()
        {
            var userId = Guid.NewGuid();
            Product q = new Product();
            Cart cart = new Cart(userId);

            cart.AddProduct(q, 7);
            Order order = new Order(userId, cart.Items);
            Assert.AreEqual(7, order.Items[q.Id]);
        }
Esempio n. 3
0
        /// <summary>
        /// Method to create the invoice using the details of the user and his shopping cart
        /// </summary>
        /// <param name="user"></param>
        /// <param name="cart"></param>
        /// <param name="address"></param>
        /// <returns></returns>
        public DataTable MakeInvoice(User user, Cart cart, Address address)
        {
            DataTable invoice_details = new DataTable();
            invoice_details.Columns.Add("Number", typeof(int));
            invoice_details.Columns.Add("Name", typeof(User));
            invoice_details.Columns.Add("Item", typeof(string));
            invoice_details.Columns.Add("Price", typeof(float));

            invoice_details.Rows.Add(Invoice_no);
            invoice_details.Rows.Add(user.name);
            invoice_details.Rows.Add(product.Name);
            invoice_details.Rows.Add(product.Price);

            return invoice_details;
        }
Esempio n. 4
0
 public Invoice()
 {
     User user = new User();
     Cart cart = new Cart(user.id);
     Product product = new Product();
 }