Ejemplo n.º 1
0
 public void removeManagerSuccTest()
 {
     try
     {
         sr.addManager(session3.getSubscribedUser(), per);
         sr.remove(session3.getSubscribedUser());
         Assert.AreEqual(store.getStoreRole(session3.getSubscribedUser()), null);
         Assert.AreEqual(session3.getSubscribedUser().getStoreRoles().Count, 0);
     }
     catch (RoleException)
     {
         Assert.Fail();
     }
 }
Ejemplo n.º 2
0
 public void removeManagerSuccTest()
 {
     sr.addManager(session2.getSubscribedUser(), per);
     Assert.AreEqual(sr.remove(session2.getSubscribedUser()), "");
     Assert.AreEqual(store.getStoreRole(session2.getSubscribedUser()), null);
     Assert.AreEqual(session2.getSubscribedUser().getStoreRoles().Count, 0);
 }
Ejemplo n.º 3
0
        public void removeRole(int storeid, string username, Session session)
        {
            SubscribedUser toRemove = DBSubscribedUser.getInstance().getSubscribedUser(username);

            if (toRemove == null)
            {
                throw new DoesntExistException("no such username");
            }
            Store store = DBStore.getInstance().getStore(storeid);

            if (store == null)
            {
                throw new DoesntExistException("no such store");
            }
            StoreRole sr = store.getStoreRole(session.getSubscribedUser());

            if (sr.getStore() != store)
            {
                throw new RoleException("this user can't remove roles from this store");
            }
            sr.remove(toRemove);
        }