Exemplo n.º 1
0
        public void User_addComplexPurchasePolicy()
        {
            setup();
            ManagerStub manger = new ManagerStub(new Store(-1, ""), manager, pcp, 2);

            manager.Roles.Add(-1, manger);
            RoleStub adminRole = new RoleStub(new Store(-1, ""), admin, pcp);

            admin.Roles.Add(-1, adminRole);
            Assert.AreEqual(pcp, admin.addComplexPurchasePolicy(0, null, -1), "Owner validate check");
            Assert.AreEqual(null, admin.addComplexPurchasePolicy(0, null, store.Id + 1), "A mistake in the identity number of the store");
            Assert.AreEqual(pcp, this.manager.addComplexPurchasePolicy(0, null, -1), "A good case");
        }
Exemplo n.º 2
0
        public void User_searchRoleByStoreIDWithValidatePermmision()
        {
            setup();
            this.manager.Roles = new Dictionary <int, Role>();
            ManagerStub manger = new ManagerStub(store, manager, pcp, 2);

            manager.Roles.Add(store.Id, manger);
            RoleStub adminRole = new RoleStub(new Store(-1, ""), admin, pcp);

            admin.Roles.Add(-1, adminRole);
            Assert.AreEqual(adminRole, admin.searchRoleByStoreIDWithValidatePermmision(-1, admin.Id), "Owner validate check");
            Assert.AreEqual(null, admin.searchRoleByStoreIDWithValidatePermmision(store.Id + 1, admin.Id), "A mistake in the identity number of the store");
            Assert.AreEqual(null, this.manager.searchRoleByStoreIDWithValidatePermmision(-1, 0), "No permissions are allowed");
            Assert.AreEqual(manger, this.manager.searchRoleByStoreIDWithValidatePermmision(store.Id, 2), "A good case");
        }