示例#1
0
        public void SendToGarbageFromStock()
        {
            ISalesController userController = new SalesController();
            IList <Stock>    Stocks         = userController.GetItems(true).FirstOrDefault(x => x.Id.Equals(1)).Stocks.ToList();
            int quantity;

            if (Stocks != null && Stocks.Count > 0)
            {
                Stock stock = Stocks.ElementAt(0);
                quantity = Convert.ToInt32(stock.Quantity);
                userController.AddGarbage(stock, 1);
                Assert.AreEqual(quantity - 1, stock.Quantity);
            }
            else
            {
                Assert.Fail("Null exception");
            }
        }
示例#2
0
        public void SendToGarbageFromBorrow()
        {
            ISalesController userController = new SalesController();
            User             user           = userController.GetAllUsers(true).FirstOrDefault(x => x.Id.Equals(1));
            IList <Borrow>   Borrows        = user.Borrows.ToList();
            int quantity;

            if (Borrows != null && Borrows.Count > 0)
            {
                Borrow borrow = Borrows.ElementAt(0);
                quantity = Convert.ToInt32(borrow.Quantity);
                userController.AddGarbage(borrow, 1);
                Assert.AreEqual(quantity - 1, borrow.Quantity);
            }
            else
            {
                Assert.Fail("Null exception");
            }
        }