示例#1
0
        public void TestMethod1_TradingSystem_basketCheckout_fail()
        {
            setUp();
            bool     retval = true;
            StubUser user   = new StubUser(2, null, null, false, false, retval);

            Assert.AreEqual(-1, sys.basketCheckout("telaviv", 2));
        }
示例#2
0
        public void TTradingSystem_addComplexPurchasePolicy()
        {
            setup();
            StubUser raul = new StubUser(7, null, null, false, false, false);

            raul.PcRet = bcp;
            sys.Users.Add(raul.Id, raul);
            Assert.AreEqual(2, sys.addComplexPurchasePolicy("", store.Id, raul.Id), "good check");
            Assert.AreEqual(-1, sys.addComplexPurchasePolicy("", store.Id, raul.Id + 1), "ProductConditionPolicy check fail");
        }
示例#3
0
        public void TTradingSystem_addSimplePurchasePolicy()
        {
            setup();
            StubUser raul = new StubUser(7, null, null, false, false, false);

            raul.PcRet = bcp;
            sys.Users.Add(raul.Id, raul);
            Assert.AreEqual(0, sys.addSimplePurchasePolicy(0, 1, 1, 1, -1, 1, null, false, store.Id, raul.Id), "ProductConditionPolicy check success");
            Assert.AreEqual(-1, sys.addSimplePurchasePolicy(0, -1, 1, 1, -1, -1, null, false, store.Id, raul.Id), "ProductConditionPolicy check fail");
        }
示例#4
0
        public void removePurchasePolicy_tradingSystem_fail()
        {
            setUp();
            StubStore sStore  = new StubStore(1234, "nike", null, null, 0);
            StubUser  tmpUser = new StubUser(2222, "owner", "7878", false, true, 0);

            system.Users.Add(tmpUser.Id, tmpUser);
            int ans = system.removePurchasePolicy(pcp.getId(), sStore.Id, tmpUser.Id);

            Assert.AreEqual(-1, ans);
        }
示例#5
0
        public void addRevealedDiscountPolicy_tradingSystem_succ()
        {
            setUp();
            StubStore sStore  = new StubStore(3456, "nike", null, null, 1);
            StubUser  tmpUser = new StubUser(2222, "owner", "7878", false, true, 1);

            system.Users.Add(tmpUser.Id, tmpUser);
            int ans = system.addConditionalDiscuntPolicy(products, "", 20, 40, 0, 0, tmpUser.Id, sStore.Id);

            Assert.AreEqual(1, ans);
        }
        public void removeRevealedDiscountPolicy_tradingSystem_succ()
        {
            setUp();
            StubStore sStore  = new StubStore(1234, "nike", null, null, 0);
            StubUser  tmpUser = new StubUser(2222, "owner", "7878", false, true, 0);

            system.Users.Add(tmpUser.Id, tmpUser);
            int ans = system.removeDiscountPolicy(discountId, sStore.Id, tmpUser.Id);

            Assert.AreEqual(0, ans);
        }
示例#7
0
        public void TestMethod1_fail_user_notRegister_scenario()
        {
            setUp();
            StubUser tmpUser  = new StubUser(123, "yuval", "4567", false, false, true);
            String   userName = tmpUser.UserName;
            String   password = tmpUser.Password;
            int      userId   = tmpUser.Id;

            system.Users.Add(tmpUser.Id, tmpUser);
            Assert.AreEqual(false, system.signIn(userName, password, userId));
        }
示例#8
0
        public void TestMethod1_fail_userName_password_scenario()
        {
            setUp();
            StubUser tmpUser  = new StubUser(123, "yuval", "4567", false, false, false);
            String   userName = "******";
            String   password = "******";
            int      userId   = tmpUser.Id;

            system.Users.Add(tmpUser.Id, tmpUser);
            Assert.AreEqual(false, system.register(userName, password, userId));
        }
示例#9
0
        public void TestMethod1_fail_system_scenario()
        {
            setUp();
            StubStore sStore          = new StubStore(3456, "nike", null, null, false);
            StubUser  ownerUserStub   = new StubUser(2222, "owner", "7878", false, true, false);
            StubUser  managerUserStub = new StubUser(2323, "babi", "3434", false, true, false);

            system.Users.Add(ownerUserStub.Id, ownerUserStub);
            system.Stores.Add(sStore.Id, sStore);
            Assert.AreEqual(false, system.assignManager(ownerUser.Id, user1.Id, store.Id, permissions));
        }
示例#10
0
        public void TestMethod1_success_scenario()
        {
            setUp();
            DBtransactions db = DBtransactions.getInstance(true);

            db.isTest(true);
            StubUser tmpUser  = new StubUser(123, "yuval", "4567", false, false, true);
            String   userName = tmpUser.UserName;
            String   password = tmpUser.Password;
            int      userId   = tmpUser.Id;

            system.Users.Add(tmpUser.Id, tmpUser);
            Assert.AreEqual(true, system.register(userName, password, userId));
        }