Пример #1
0
 public void RemoveNotCreatoreOwner()
 {
     ss.addStoreOwner(store.getStoreId(), "zahi", itamar);
     Assert.IsTrue(us.removeUser(admin, "zahi") >= 0);
     Assert.IsFalse(us.login(zahi, "zahi", "123456") >= 0);
     Assert.AreEqual(store.getOwners().Count, 1);
 }
        public void OwnerTryAddOtherOwnerToBeStoreManager()
        {
            User aviad = us.startSession();

            us.register(aviad, "aviad", "123456");
            us.login(aviad, "aviad", "123456");
            int   storeid = ss.createStore("abowim", zahi);
            Store store   = StoreManagement.getInstance().getStore(storeid);

            ss.addStoreOwner(store.getStoreId(), "aviad", zahi);
            ss.addStoreManager(store.getStoreId(), "aviad", zahi);
            LinkedList <StoreManager> managers = store.getManagers();

            Assert.AreEqual(managers.Count, 0);
        }
Пример #3
0
        public void AddOtherUserAsStoreOwnerWithoutBeingOwner()
        {
            User aviad = us.startSession();

            us.register(aviad, "aviad", "123456");
            us.login(aviad, "aviad", "123456");
            User itamar = us.startSession();

            us.register(itamar, "itamar", "123456");
            us.login(itamar, "itamar", "123456");
            User          niv     = new User("niv", "123456");
            storeServices ss      = storeServices.getInstance();
            int           storeid = ss.createStore("abowim", zahi);
            Store         store   = StoreManagement.getInstance().getStore(storeid);

            ss.addStoreOwner(store.getStoreId(), "itamar", aviad);
            LinkedList <StoreOwner> Userowners = store.getOwners();
            LinkedList <User>       owners     = new LinkedList <User>();

            foreach (StoreOwner o in Userowners)
            {
                owners.AddFirst(o.getUser());
            }
            Assert.AreEqual(owners.Count, 1);
            Assert.IsTrue(owners.Contains(zahi));
            ss.addStoreOwner(store.getStoreId(), "niv", aviad);
            LinkedList <StoreOwner> Userowners2 = store.getOwners();
            LinkedList <User>       owners2     = new LinkedList <User>();

            foreach (StoreOwner o in Userowners2)
            {
                owners2.AddFirst(o.getUser());
            }
            Assert.AreEqual(owners2.Count, 1);
            Assert.IsTrue(owners2.Contains(zahi));
        }
Пример #4
0
        public void simpleAddStoreOwner()
        {
            User aviad = us.startSession();

            us.register(aviad, "aviad", "123456");
            aviad.login("aviad", "123456");
            int   storeid = ss.createStore("abowim", zahi);
            Store store   = StoreManagement.getInstance().getStore(storeid);

            ss.addStoreOwner(store.getStoreId(), "aviad", zahi);
            LinkedList <StoreOwner> Userowners = store.getOwners();
            LinkedList <String>     owners     = new LinkedList <String>();

            foreach (StoreOwner o in Userowners)
            {
                owners.AddFirst(o.getUser().getUserName());
            }
            Assert.AreEqual(owners.Count, 2);
            Assert.IsTrue(owners.Contains("zahi"));
            Assert.IsTrue(owners.Contains("aviad"));
        }
Пример #5
0
 public void SimpleRemoveStoreOwner()
 {
     ss.addStoreOwner(store.getStoreId(), "zahi", itamar);
     Assert.AreEqual(ss.removeStoreOwner(store.getStoreId(), "zahi", itamar), 0);
     Assert.AreEqual(ss.getOwners(store.getStoreId()).Count, 1);
 }