public void AdminController_RemoveItem_Success()
        {
            Users user = new Users {
                Id = 1, UserName = "******"
            };
            var cancel = new CancellationToken();

            var adminRemoveModel = new AdminModel
            {
                ModelName = "modelName",
            };

            var productService = new StoreProductService(_context);
            var userService    = new UserService(_context);

            var mockUserStore = new Mock <IUserStore <Users> >();

            mockUserStore.Setup(u => u.CreateAsync(user, cancel));

            var manager = new UserManager <Users>(mockUserStore.Object, null, null, null, null, null, null, null, null);

            var Controller = new AdminController(productService, manager, userService, null);

            var addItem        = Controller.AddItem(adminModel);
            var getItemsBefore = productService.GetAll();

            Assert.Single(getItemsBefore);

            var removeItem    = Controller.RemoveItem(adminRemoveModel);
            var getItemsAfter = productService.GetAll();

            Assert.Empty(getItemsAfter);
            Assert.Equal("Item Was Sucessfully Removed", removeItem.Value);
        }
        public void AdminController_UpdateItem_Success()
        {
            Users user = new Users {
                Id = 1, UserName = "******"
            };
            var cancel = new CancellationToken();

            var adminUpdateModel = new AdminModel
            {
                Availibility = 1,
                Price        = 12,
                Discount     = 0,
                Color        = "Orange",
                ModelName    = "modelName",
                SpecSpec     = "Specification",
                SpecDesc     = "Description"
            };

            var productService = new StoreProductService(_context);
            var userService    = new UserService(_context);

            var mockUserStore = new Mock <IUserStore <Users> >();

            mockUserStore.Setup(u => u.CreateAsync(user, cancel));

            var manager    = new UserManager <Users>(mockUserStore.Object, null, null, null, null, null, null, null, null);
            var Controller = new AdminController(productService, manager, userService, null);

            var addItem = Controller.AddItem(adminModel);

            var getItemsBefore = productService.GetAll();

            Assert.Equal("itemColor", getItemsBefore.First().Color);

            var updateItem = Controller.UpdateItems(adminUpdateModel);

            var getItemsPost = productService.GetAll();

            Assert.Single(getItemsPost);
            Assert.Equal("Orange", getItemsPost.First().Color);
            Assert.Equal(1, getItemsPost.First().Availability);
            Assert.Equal("Item Updated", updateItem.Value);
        }
        public void AdminController_AddItem_Success()
        {
            Users user = new Users {
                Id = 1, UserName = "******"
            };
            var cancel = new CancellationToken();

            var productService = new StoreProductService(_context);
            var userService    = new UserService(_context);

            var mockUserStore = new Mock <IUserStore <Users> >();

            mockUserStore.Setup(u => u.CreateAsync(user, cancel));

            var manager = new UserManager <Users>(mockUserStore.Object, null, null, null, null, null, null, null, null);

            var Controller = new AdminController(productService, manager, userService, null);
            var addItem    = Controller.AddItem(adminModel);
            var getItems   = productService.GetAll();

            Assert.Single(getItems);
            Assert.Equal("itemColor", getItems.First().Color);
            Assert.Equal("Item added!", addItem.Value);
        }