public void CreateOrderWithReturnedPrimaryKey() { Customer c = customerDB.Get("email", "*****@*****.**"); Order o = new Order(c); o.Orderlines.Add(new OrderLine(2, 200, productDB.Get("productID", 1.ToString()))); o = orderDB.Create(o); Assert.IsTrue(o.ID > 0); }
// Creates an order with customer and returns an order based on validation public Order CreateOrder(string firstName, string lastName, string street, int zip, string city, string email, int number, List <OrderLine> ol) { // Checks if customer exists in the database. If customer exists we update, // otherwise we create a new customer. Customer c = cl.HandleCustomer(firstName, lastName, street, zip, city, email, number); Order o = new Order(c); // Validates the prices for each orderline on the order. o.Orderlines = ol; o.Total = TotalOrderPrice(ol); o.ID = orderDB.Create(o).ID; return(o); }