コード例 #1
0
        public void createStoreAndOwnerMannegerFromeManegerWioutPremition()
        {
            User aviad = new User("aviad", "123456");

            aviad.register("aviad", "123456");
            User zahi = new User("zahi", "123456");

            zahi.register("zahi", "123456");
            User niv = new User("niv", "123456");

            niv.register("niv", "123456");
            aviad.login("aviad", "123456");
            int   storeId = aviad.createStore("bro burger");
            Store s       = StoreManagement.getInstance().getStore(storeId);

            Assert.AreEqual(s.getStoreName(), "bro burger");
            Assert.AreEqual(s.getOwners().Count, 1);
            StoreRole sr = new StoreOwner(aviad, s);

            sr.addStoreManager(aviad, s, "niv");
            Assert.AreEqual(s.getManagers().Count, 1);
            sr.addManagerPermission(aviad, "removeStoreManager", s, "niv");
            niv.login("niv", "123456");
            sr.addStoreManager(niv, s, "zahi");
            Assert.AreEqual(s.getManagers().Count, 2);
        }
コード例 #2
0
        public void createStoreAndOwnerMannegerNotOwner()
        {
            User aviad = new User("aviad", "123456");

            aviad.register("aviad", "123456");
            User zahi = new User("zahi", "123456");

            zahi.register("zahi", "123456");
            User niv = new User("niv", "123456");

            niv.register("niv", "123456");
            aviad.login("aviad", "123456");
            zahi.login("zahi", "123456");
            int   storeId = aviad.createStore("bro burger");
            Store s       = StoreManagement.getInstance().getStore(storeId);

            Assert.AreEqual(s.getStoreName(), "bro burger");
            Assert.AreEqual(s.getOwners().Count, 1);
            StoreRole sr = new StoreOwner(aviad, s);

            sr.addStoreOwner(zahi, s, "niv");
            Assert.AreEqual(s.getOwners().Count, 2);
            sr.addStoreManager(zahi, s, "niv");
            Assert.AreEqual(s.getManagers().Count, 0);
        }