public void RemoveProductFromCategoryWhenStoreNotExists()
        {
            RemoveProductFromCategorySlave slave = new RemoveProductFromCategorySlave("noStore", userService.Object, handler.Object);

            slave.RemoveProductFromCategory("WanderlandItems", "OnePunchManPoster");
            Assert.AreEqual((int)StoreEnum.StoreNotExists, slave.Answer.Status);
        }
        public void RemoveProductFromCategoryWhenCategoryNotExists()
        {
            RemoveProductFromCategorySlave slave = new RemoveProductFromCategorySlave("T", userService.Object, handler.Object);

            handler.Setup(x => x.IsStoreExistAndActive("T")).Returns(true);
            handler.Setup(x => x.GetStorebyName("T")).Returns(new Store("S7", "T", "bla"));
            slave.RemoveProductFromCategory("BB", "OnePunchManPoster");
            Assert.AreEqual((int)StoreEnum.CategoryNotExistsInStore, slave.Answer.Status);
        }
        public void RemoveProductFromCategoryWhenHasNoPremmision()
        {
            RemoveProductFromCategorySlave slave = new RemoveProductFromCategorySlave("T", userService.Object, handler.Object);

            handler.Setup(x => x.IsStoreExistAndActive("T")).Returns(true);
            handler.Setup(x => x.GetStorebyName("T")).Returns(new Store("S7", "T", "bla"));
            userService.Setup(x => x.CanManageProducts()).Throws(new MarketException(9, "bla"));
            slave.RemoveProductFromCategory("WanderlandItems", "OnePunchManPoster");
            Assert.AreEqual((int)StoreEnum.NoPermission, slave.Answer.Status);
        }
        public void RemoveProductFromWhenProductNotExists()
        {
            RemoveProductFromCategorySlave slave = new RemoveProductFromCategorySlave("T", userService.Object, handler.Object);

            handler.Setup(x => x.IsStoreExistAndActive("T")).Returns(true);
            handler.Setup(x => x.GetStorebyName("T")).Returns(new Store("S7", "T", "bla"));
            handler.Setup(x => x.GetCategoryByName("WanderlandItems"))
            .Returns(new Category("C1", "WanderlandItems"));
            slave.RemoveProductFromCategory("WanderlandItems", "OnePunchManPoster");
            Assert.AreEqual((int)StoreEnum.ProductNotFound, slave.Answer.Status);
        }
        public void RemoveProductFromCategorySuccess()
        {
            RemoveProductFromCategorySlave slave = new RemoveProductFromCategorySlave("T", userService.Object, handler.Object);

            handler.Setup(x => x.IsStoreExistAndActive("T")).Returns(true);
            handler.Setup(x => x.GetStorebyName("T")).Returns(new Store("S7", "T", "bla"));
            handler.Setup(x => x.GetCategoryByName("WanderlandItems"))
            .Returns(new Category("C1", "WanderlandItems"));
            handler.Setup(x => x.GetProductByNameFromStore("T", "Fraid Egg")).Returns(new Product("S21", "Fraid Egg", 10, "bla"));
            LinkedList <Product> expected = new LinkedList <Product>();

            expected.AddLast(new Product("S21", "Fraid Egg", 10, "bla"));
            handler.Setup(x => x.GetAllCategoryProducts("C1")).Returns(expected);
            slave.RemoveProductFromCategory("WanderlandItems", "Fraid Egg");
            Assert.AreEqual((int)StoreEnum.Success, slave.Answer.Status);
        }