Esempio n. 1
0
        /// <summary>
        /// Creates a new order header (by using LogicLayer class)
        /// Retrieves the id from that new order header
        /// Passes that id to the new AddOrderView page
        /// Closes the current page
        /// </summary>

        private void Btn_AddPage_Click(object sender, RoutedEventArgs e)
        {
            int          orderHeaderId = layer.CreateNewOrderHeader();
            AddOrderView pageobj       = new AddOrderView(orderHeaderId);

            pageobj.Show();
            Close();
        }
        public void TestOne()
        {
            this.orderHeaderId = layer.CreateNewOrderHeader();

            IEnumerable <StockItem> allItems = layer.GetStockItems();

            double price = allItems.ElementAt(0).Price;

            OrderItem input = new OrderItem("In_stock", orderHeaderId, price,
                                            quantityOfStockItemTested, idOfStockItemTested, price * quantityOfStockItemTested);

            layer.UpsertOrderItem(input.Description, input.Price, input.OrderHeaderId,
                                  input.StockItemId, input.Quantity);

            OrderItem output = layer.ProcessOrder(orderHeaderId).ElementAt(0);

            //checking that the input and output are equal
            Assert.AreEqual(input.Description + " " + input.Price + " " + input.OrderHeaderId +
                            " " + input.StockItemId + " " + input.Quantity + " " + input.Total,
                            output.Description + " " + output.Price + " " + output.OrderHeaderId + " " +
                            output.StockItemId + " " + output.Quantity + " " + output.Total);
        }