Пример #1
0
        public async void Task_Put_CategoryById_OKResult()
        {
            var controller      = new ProductCategoryController(context);
            int id              = 3;
            var productCategory = new ProductCategory()
            {
                ProductCategoryId   = 3,
                CategoryName        = "Summer Collection",
                CategoryDescription = "Cotton Material"
            };
            var data = await controller.Put(id, productCategory);

            Assert.IsType <NoContentResult>(data);
        }
Пример #2
0
        public async void Task_Put_CategoryBYID_Return_BadResult()
        {
            var controller      = new ProductCategoryController(context);
            int?id              = null;
            var productCategory = new ProductCategory()
            {
                //UserId = null,
                CategoryName        = "summmerrrrrr",
                CategoryDescription = "Collections"
            };
            var data = await controller.Put(id, productCategory);

            Assert.IsType <BadRequestResult>(data);
        }
        public async void Task_PutUserId_BadResult()
        {
            var controller = new ProductCategoryController(_context);
            int?id         = null;

            var user = new ProductCategory()
            {
                CategoryName        = "Formals",
                CategoryDescription = "Be professionals"
            };
            var data = await controller.Put(id, user);

            Assert.IsType <BadRequestResult>(data);
        }
        public async void Task_PutUserId_OkResult()
        {
            var controller = new ProductCategoryController(_context);
            int id         = 13;

            var user = new ProductCategory()
            {
                ProductCategoryId   = 13,
                CategoryName        = "Summers",
                CategoryDescription = "Shirt"
            };
            var data = await controller.Put(id, user);

            Assert.IsType <NoContentResult>(data);
        }
        public async void Task_Put_ProductCategoryByID_Return_BadRequest()
        {
            var controller      = new ProductCategoryController(context);
            int?id              = null;
            var productcategory = new ProductCategory()

            {
                ProductCategoryId   = 2,
                CategoryName        = "Autmn Collections",
                CategoryDescription = "Floral Collection",
            };

            var data = await controller.Put(id, productcategory);

            Assert.IsType <BadRequestResult>(data);
        }
Пример #6
0
        public async void Task_PutPC_Return_BadRequest()
        {
            //Arrange
            var controller = new ProductCategoryController(context);
            int?id         = null;
            var pc         = new ProductCategory()
            {
                ProductCategoryName        = "Shirtsss",
                ProductCategoryDescription = "Plain"
            };
            //Act
            var data = await controller.Put(id, pc);

            //Assert
            Assert.IsType <BadRequestResult>(data);
        }
        public async void Task_Put_ProductCategoryByID_MatchResult()
        {
            var controller = new ProductCategoryController(context);
            int id         = 2;

            var productcategory = new ProductCategory()

            {
                ProductCategoryId   = 2,
                CategoryName        = "Spring Collection",
                CategoryDescription = "Floral Material",
            };

            var data = await controller.Put(id, productcategory);

            Assert.IsType <NoContentResult>(data);
        }
Пример #8
0
        public async void Task_PutPC_Return_Notfound()
        {
            //Arrange
            var controller = new ProductCategoryController(context);
            int?id         = 13;
            var pc         = new ProductCategory()
            {
                ProductCategoryId          = 1003,
                ProductCategoryName        = "Shirtss",
                ProductCategoryDescription = "Plain"
            };
            //Act
            var data = await controller.Put(id, pc);

            //Assert
            Assert.IsType <NotFoundResult>(data);
        }
Пример #9
0
        public async void Task_PutPC_Return_OkResult()
        {
            //Arrange
            var controller = new ProductCategoryController(context);
            int id         = 4;
            var pc         = new ProductCategory()
            {
                ProductCategoryId          = 4,
                ProductCategoryName        = "Shirts",
                ProductCategoryDescription = "Plain"
            };
            //Act
            var data = await controller.Put(id, pc);

            //Assert
            Assert.IsType <NoContentResult>(data);
        }