Ejemplo n.º 1
0
        public MarketAnswer AddQuanitityToProduct(string productName, int quantity)
        {
            if (real != null)
            {
                return(real.AddQuanitityToProduct(productName, quantity));
            }

            throw new NotImplementedException();
        }
Ejemplo n.º 2
0
        public void ChangeQuantityOfProductSuccessfully()
        {
            MarketAnswer result2 = _storeManage1.AddQuanitityToProduct("bamba", 30);

            Assert.AreEqual((int)StoreEnum.Success, result2.Status);
            MarketAnswer stockAnswer = _storeBridge.ViewStoreStock("lokef");

            string[] actualResult   = stockAnswer.ReportList;
            string[] expectedResult = { " name: bamba base price: 90 description: nice snack Discount: {null} Purchase Way: Immediate Quantity: 60" };
            Assert.AreEqual(expectedResult.Length, actualResult.Length);
            for (int i = 0; i < actualResult.Length; i++)
            {
                Assert.AreEqual(expectedResult[i], actualResult[i]);
            }
        }
Ejemplo n.º 3
0
        public void ChangeProductsQuantityIsNegative()
        {
            _storeManage2 = StoreManagementDriver.getBridge();
            _storeManage2.GetStoreManagementService(_userBridge.GetUserSession(), "lokef");
            MarketAnswer res = _storeManage2.AddQuanitityToProduct("bambuuuu", -10);

            Assert.AreEqual((int)StoreEnum.ProductNotFound, res.Status);
            MarketAnswer stockAnswer = _storeBridge.ViewStoreStock("lokef");

            string[] actualResult   = stockAnswer.ReportList;
            string[] expectedResult = { " name: bamba base price: 90 description: nice snack Discount: {null} Purchase Way: Immediate Quantity: 30" };
            Assert.AreEqual(expectedResult.Length, actualResult.Length);
            for (int i = 0; i < actualResult.Length; i++)
            {
                Assert.AreEqual(expectedResult[i], actualResult[i]);
            }
        }
Ejemplo n.º 4
0
        public void ChangeProductsQuantityStoreDoesntExist()
        {
            _storeManage2 = StoreManagementDriver.getBridge();
            _storeManage2.GetStoreManagementService(_userBridge.GetUserSession(), "hahaha");
            MarketAnswer res2 = _storeManage2.AddQuanitityToProduct("bamba", 30);

            Assert.AreEqual((int)StoreEnum.StoreNotExists, res2.Status);
            MarketAnswer stockAnswer = _storeBridge.ViewStoreStock("lokef");

            string[] actualResult = stockAnswer.ReportList;
            //didn't succeed in removing the product, there is still one product
            string[] expectedResult = { " name: bamba base price: 90 description: nice snack Discount: {null} Purchase Way: Immediate Quantity: 30" };
            Assert.AreEqual(expectedResult.Length, actualResult.Length);
            for (int i = 0; i < actualResult.Length; i++)
            {
                Assert.AreEqual(expectedResult[i], actualResult[i]);
            }
        }
Ejemplo n.º 5
0
        public void ChangeProductsQuantityNoUserPermissions()
        {
            SignUp(ref _userBridge2, "BASH", "lo kef2", "777777", "88888888");
            _storeManage2 = StoreManagementDriver.getBridge();
            _storeManage2.GetStoreManagementService(_userBridge2.GetUserSession(), "lokef");
            MarketAnswer res2 = _storeManage2.AddQuanitityToProduct("bamba", 30);

            Assert.AreEqual((int)StoreEnum.NoPermission, res2.Status);
            MarketAnswer stockAnswer = _storeBridge.ViewStoreStock("lokef");

            string[] actualResult   = stockAnswer.ReportList;
            string[] expectedResult = { " name: bamba base price: 90 description: nice snack Discount: {null} Purchase Way: Immediate Quantity: 30" };
            Assert.AreEqual(expectedResult.Length, actualResult.Length);
            for (int i = 0; i < actualResult.Length; i++)
            {
                Assert.AreEqual(expectedResult[i], actualResult[i]);
            }
        }