Example #1
0
        public async void BuyShoppingBasketTest()
        {
            //PaymentStub.setRet(true);
            //SupplyStub.setRet(true);
            IPayment payStub    = new PaymentStub(true);
            ISupply  supplyStub = new SupplyStub(true);

            ConsistencyStub.setRet(true);

            //init
            addingProductToBasket(amountToBuy, 0);
            addingProductToBasket(amountToBuy, 0);
            addingProductToBasket(amountToBuy, 1);
            //PaymentStub.setRet(true);
            //SupplyStub.setRet(true);
            ConsistencyStub.setRet(true);

            int         ccv = 0, month = 10, year = 2050, id = 123456789;
            string      holder = "mosh moshe", city = "shit", country = "shit", zip = "12345", address = "", cardNumber = "0";
            Transaction transaction = new Transaction();
            await transaction.doTransaction(user.user, cardNumber, month, year, holder, ccv, id, holder, address, city, country, zip, payStub, supplyStub);

            int transId = transaction.id;

            Assert.IsTrue(transId > 0, "1");
            //chack the basket is empty
            Assert.IsTrue(userShoppingBasket.isEmpty(), "2");
            //check the product amount has reduced
            Assert.AreEqual(productAmount - (2 * amountToBuy), product[0].amount);
            Assert.AreEqual(productAmount - amountToBuy, product[1].amount);
            //try to purches bad amount
        }
        public void SupplySystemConnectionTestInner()
        {
            SupplyStub supplyStub = new SupplyStub(true);
            bool       result     = supplyStub.connectionTest();

            Assert.IsTrue(result);
        }