Esempio n. 1
0
        public void BadCombo1()
        {
            AddPolicySlave slave = new AddPolicySlave(admin.Object, manager.Object);

            slave.CreatePolicy("Global", null, "Quantity <=", "shit", "");
            Assert.AreEqual((int)EditPolicyStatus.InvalidPolicyData, slave.Answer.Status);
        }
Esempio n. 2
0
        public void AddGlobalPolicySuccess()
        {
            AddPolicySlave slave = new AddPolicySlave(admin.Object, manager.Object);

            slave.CreatePolicy("Global", null, "Quantity <=", "5", "");
            Assert.AreEqual((int)EditPolicyStatus.Success, slave.Answer.Status);
        }
Esempio n. 3
0
        public void BadCategoryPolicyType()
        {
            AddPolicySlave slave = new AddPolicySlave(admin.Object, manager.Object);

            slave.CreatePolicy("Category", "", "Quantity <=", "5", "");
            Assert.AreEqual((int)EditPolicyStatus.InvalidPolicyData, slave.Answer.Status);
        }
Esempio n. 4
0
        public void AddCategoryPolicySuccess()
        {
            AddPolicySlave slave = new AddPolicySlave(admin.Object, manager.Object);

            slave.CreatePolicy("Category", "Shitty Products", "Quantity <=", "5", "");
            Assert.AreEqual((int)EditPolicyStatus.Success, slave.Answer.Status);
        }
Esempio n. 5
0
        public void BadCombo1()
        {
            AddPolicySlave slave = new AddPolicySlave(seller.Object, manager.Object);

            slave.CreatePolicy("StockItem", "Cluckin Bell", "#9", "Quantity <=", "shit", "");
            Assert.AreEqual((int)EditStorePolicyStatus.InvalidPolicyData, slave.Answer.Status);
        }
Esempio n. 6
0
        public void BadPolicyType()
        {
            AddPolicySlave slave = new AddPolicySlave(seller.Object, manager.Object);

            slave.CreatePolicy("Shit", null, "#9", "Quantity <=", "5", "");
            Assert.AreEqual((int)EditStorePolicyStatus.InvalidPolicyData, slave.Answer.Status);
        }
Esempio n. 7
0
        public void AddStorePolicySuccess()
        {
            AddPolicySlave slave = new AddPolicySlave(seller.Object, manager.Object);

            slave.CreatePolicy("Store", "Cluckin Bell", null, "Quantity <=", "5", "");
            Assert.AreEqual((int)EditStorePolicyStatus.Success, slave.Answer.Status);
        }
Esempio n. 8
0
        public void SavePolicySuccess2()
        {
            AddPolicySlave slave = new AddPolicySlave(admin.Object, manager.Object);

            slave.CreatePolicy("Category", "Shitty Products", "Address =", "Sunnyvale", "");
            slave.SaveFullPolicy();
            Assert.AreEqual((int)EditPolicyStatus.Success, slave.Answer.Status);
        }
Esempio n. 9
0
        public void NoAuthority2()
        {
            admin.Setup(x => x.ValidateSystemAdmin())
            .Throws(new MarketException((int)ManageMarketSystem.NotSystemAdmin, ""));
            AddPolicySlave slave = new AddPolicySlave(admin.Object, manager.Object);

            slave.SaveFullPolicy();
            Assert.AreEqual((int)EditPolicyStatus.NoAuthority, slave.Answer.Status);
        }
Esempio n. 10
0
        public void NoAuthority1()
        {
            admin.Setup(x => x.ValidateSystemAdmin())
            .Throws(new MarketException((int)ManageMarketSystem.NotSystemAdmin, ""));
            AddPolicySlave slave = new AddPolicySlave(admin.Object, manager.Object);

            slave.CreatePolicy("Global", null, "Quantity <=", "5", "");
            Assert.AreEqual((int)EditPolicyStatus.NoAuthority, slave.Answer.Status);
        }
Esempio n. 11
0
        public void NoAuthority2()
        {
            seller.Setup(x => x.CanDeclarePurchasePolicy())
            .Throws(new MarketException((int)PromoteStoreStatus.NoAuthority, ""));
            AddPolicySlave slave = new AddPolicySlave(seller.Object, manager.Object);

            slave.SaveFullPolicy();
            Assert.AreEqual((int)EditStorePolicyStatus.NoAuthority, slave.Answer.Status);
        }
Esempio n. 12
0
        public void NoAuthority1()
        {
            seller.Setup(x => x.CanDeclarePurchasePolicy())
            .Throws(new MarketException((int)PromoteStoreStatus.NoAuthority, ""));
            AddPolicySlave slave = new AddPolicySlave(seller.Object, manager.Object);

            slave.CreatePolicy("StockItem", null, null, "Quantity <=", "5", "");
            Assert.AreEqual((int)EditStorePolicyStatus.NoAuthority, slave.Answer.Status);
        }