Ejemplo n.º 1
0
        public void Delete_Detail_From_Sale()
        {
            ItemLogic itemlogic = new ItemLogic();
            Item item = itemlogic.GetItemByID(1);

            SaleLogic logic = new SaleLogic();
            decimal total = logic.CalculateSaleTotal(testSale, testDetails);
            logic.AddSale(testSale, testDetails);
            logic.DeleteDetailFromSale(testSale, item, detail);
        }
Ejemplo n.º 2
0
        public void Calculate_Sale_Total()
        {
            CreateTestSale();
            ItemLogic itemLogic = new ItemLogic();
            Item item1 = itemLogic.GetItemByID(2);
            Item item2 = itemLogic.GetItemByID(3);

            decimal trueTotal = detail.Quantity * item1.Cost + detail2.Quantity * item2.Cost;

            SaleLogic logic = new SaleLogic();
            decimal calculatedTotal = logic.CalculateSaleTotal(testSale, testDetails);
            Assert.AreEqual(trueTotal, calculatedTotal, "Not equal");
        }
Ejemplo n.º 3
0
        public static void CreateTestSale()
        {
            testSale.ClientId = 1;
            testSale.ShippingAddressId = 1;
            testSale.Date = DateTime.Now;

            detail.ItemId = 2;
            detail.Quantity = 2;
            detail.SaleId = testSale.SaleId;
            detail2.ItemId = 3;
            detail2.Quantity = 1;
            detail2.SaleId = testSale.SaleId;

            testDetails.Add(detail);
            testDetails.Add(detail2);

            SaleLogic logic = new SaleLogic();
            decimal total = logic.CalculateSaleTotal(testSale, testDetails);
            testSale.SaleTotal = total;
        }
Ejemplo n.º 4
0
        public void Update_Sale_From_Database()
        {
            CreateTestSale();

            ItemLogic itemlogic = new ItemLogic();
            Item item = itemlogic.GetItemByID(1);

            SaleLogic logic = new SaleLogic();
            decimal total = logic.CalculateSaleTotal(testSale, testDetails);
            detail.Quantity = 3;
            logic.UpdateSale(testSale, item, detail);
        }