Exemplo n.º 1
0
        public void ViewStoreNoPremission()
        {
            StoreShoppingService liorSession = (StoreShoppingService)market.GetStoreShoppingService(ref userService);
            MarketAnswer         ans         = liorSession.ViewStoreInfo("X");

            Assert.AreEqual((int)ViewStoreStatus.InvalidUser, ans.Status);
        }
Exemplo n.º 2
0
        public void ViewStoreStockWhenHasNoPremmision()
        {
            StoreShoppingService liorSession = (StoreShoppingService)market.GetStoreShoppingService(ref userService);
            MarketAnswer         ans         = liorSession.ViewStoreStock("X");

            Assert.AreEqual((int)StoreEnum.NoPermission, ans.Status);
        }
Exemplo n.º 3
0
 public void MarketBuilder()
 {
     MarketDB.Instance.InsertByForce();
     marketSession       = MarketYard.Instance;
     userServiceSession  = (UserService)marketSession.GetUserService();
     userShopperHarmony  = new UserShopperHarmony(ref userServiceSession);
     storeServiceSession = (StoreShoppingService)marketSession.GetStoreShoppingService(ref userServiceSession);
 }
Exemplo n.º 4
0
        public void AddToCartWhenHasNoPermission()
        {
            StoreShoppingService liorSession = (StoreShoppingService)market.GetStoreShoppingService(ref userService);
            Store        find = handler.GetStorebyName("X");
            MarketAnswer ans  = liorSession.AddProductToCart("X", "BOX", 6);

            Assert.AreEqual((int)StoreEnum.NoPermission, ans.Status);
        }
Exemplo n.º 5
0
        public void ViewStoreBadInputTest()
        {
            StoreShoppingService liorSession = (StoreShoppingService)market.GetStoreShoppingService(ref userService);

            liorSession.MakeGuest();
            MarketAnswer ans = liorSession.ViewStoreInfo("'X");

            Assert.AreEqual((int)StoreEnum.BadInput, ans.Status);
        }
Exemplo n.º 6
0
        public void ViewStoreStoreNotFound()
        {
            StoreShoppingService liorSession = (StoreShoppingService)market.GetStoreShoppingService(ref userService);

            liorSession.MakeGuest();
            MarketAnswer ans = liorSession.ViewStoreInfo("notStore");

            Assert.AreEqual((int)ViewStoreStatus.NoStore, ans.Status);
        }
Exemplo n.º 7
0
        public void ViewStoreStockBadInputFail()
        {
            StoreShoppingService liorSession = (StoreShoppingService)market.GetStoreShoppingService(ref userService);

            liorSession.LoginShoper("Arik3", "123");
            MarketAnswer ans = liorSession.ViewStoreStock("X'");

            Assert.AreEqual((int)StoreEnum.BadInput, ans.Status);
        }
Exemplo n.º 8
0
        public void OpenStoreBadInputFail()
        {
            StoreShoppingService liorSession = (StoreShoppingService)market.GetStoreShoppingService(ref userService);

            liorSession.LoginShoper("Arik3", "123");
            MarketAnswer ans = liorSession.OpenStore("newSto'reName", "adress");

            Assert.AreEqual((int)OpenStoreStatus.BadInput, ans.Status);
        }
Exemplo n.º 9
0
        public void ViewStoreStockWhenStoreNotExists()
        {
            StoreShoppingService liorSession = (StoreShoppingService)market.GetStoreShoppingService(ref userService);

            liorSession.LoginShoper("Arik3", "123");
            MarketAnswer ans = liorSession.ViewStoreStock("STORE_NOT_EXISTS");

            Assert.AreEqual((int)StoreEnum.StoreNotExists, ans.Status);
        }
Exemplo n.º 10
0
        public void AddToCartSuccess()
        {
            StoreShoppingService liorSession = (StoreShoppingService)market.GetStoreShoppingService(ref userService);

            liorSession.MakeGuest();
            Store        find = handler.GetStorebyName("X");
            MarketAnswer ans  = liorSession.AddProductToCart("X", "BOX", 1);

            Assert.AreEqual((int)StoreEnum.Success, ans.Status);
        }
Exemplo n.º 11
0
        public void AddToCartWhenQuantityisTooBig()
        {
            StoreShoppingService liorSession = (StoreShoppingService)market.GetStoreShoppingService(ref userService);

            liorSession.MakeGuest();
            Store        find = handler.GetStorebyName("X");
            MarketAnswer ans  = liorSession.AddProductToCart("X", "BOX", 999999);

            Assert.AreEqual((int)StoreEnum.QuantityIsTooBig, ans.Status);
        }
Exemplo n.º 12
0
        public void AddToCartWhenProductIsNotExistsInStore()
        {
            StoreShoppingService liorSession = (StoreShoppingService)market.GetStoreShoppingService(ref userService);

            liorSession.MakeGuest();
            Store        find = handler.GetStorebyName("X");
            MarketAnswer ans  = liorSession.AddProductToCart("X", "BOBO", 6);

            Assert.AreEqual((int)StoreEnum.ProductNotFound, ans.Status);
        }
Exemplo n.º 13
0
        public void OpenStoreInterfaceLevelSameName()
        {
            StoreShoppingService liorSession = (StoreShoppingService)market.GetStoreShoppingService(ref userService);

            liorSession.LoginShoper("Arik3", "123");
            MarketAnswer ans = liorSession.OpenStore("newStoreName", "adress");

            toDeleteStore = handler.GetStorebyName("newStoreName");
            ans           = liorSession.OpenStore("newStoreName", "adress");
            Assert.AreEqual((int)OpenStoreStatus.AlreadyExist, ans.Status);
        }
Exemplo n.º 14
0
        public void AddToCartWhenStoreNotExists()
        {
            StoreShoppingService liorSession = (StoreShoppingService)market.GetStoreShoppingService(ref userService);

            liorSession.MakeGuest();
            Store find = handler.GetStorebyName("newStoreName");

            Assert.IsNull(find);
            MarketAnswer ans = liorSession.AddProductToCart("newStoreName", "ppp", 6);

            Assert.AreEqual((int)StoreEnum.StoreNotExists, ans.Status);
        }
Exemplo n.º 15
0
        public void OpenStoreInterfaceLevelFail()
        {
            StoreShoppingService liorSession = (StoreShoppingService)market.GetStoreShoppingService(ref userService);

            liorSession.MakeGuest();
            Store find = handler.GetStorebyName("newStoreName");

            Assert.IsNull(find);
            MarketAnswer ans = liorSession.OpenStore("newStoreName", "adress");

            Assert.AreEqual((int)OpenStoreStatus.InvalidUser, ans.Status);
        }
 public void MarketBuilder()
 {
     MarketDB.Instance.InsertByForce();
     marketSession       = MarketYard.Instance;
     userServiceSession  = (UserService)marketSession.GetUserService();
     userServiceSession2 = (UserService)marketSession.GetUserService();
     userServiceSession3 = (UserService)marketSession.GetUserService();
     userServiceSession2.EnterSystem();
     userServiceSession3.EnterSystem();
     userServiceSession2.SignIn(sysadmin, pass);
     sysadminSession = marketSession.GetSystemAdminService(userServiceSession2);
     userServiceSession.EnterSystem();
     orderServiceSession = (OrderService)marketSession.GetOrderService(ref userServiceSession);
     storeServiceSession = (StoreShoppingService)marketSession.GetStoreShoppingService(ref userServiceSession);
 }
Exemplo n.º 17
0
        public void OpenStoreInterfaceLevelPass()
        {
            StoreShoppingService liorSession = (StoreShoppingService)market.GetStoreShoppingService(ref userService);

            liorSession.LoginShoper("Arik3", "123");
            Store find = handler.GetStorebyName("newStoreName");

            Assert.IsNull(find);
            MarketAnswer ans = liorSession.OpenStore("newStoreName", "adress");

            find = handler.GetStorebyName("newStoreName");
            Assert.IsNotNull(find);
            toDeleteStore = handler.GetStorebyName("newStoreName");
            Assert.IsNotNull(toDeleteStore);
            Assert.AreEqual((int)OpenStoreStatus.Success, ans.Status);
        }