示例#1
0
        public void ProductController_AddCategory_ShouldReturnAPartialViewResult()
        {
            var product = new Product {
                Id = 123
            };

            PartialViewResult result = _productController.AddCategory(product, "query", 1);

            result.Should().BeOfType <PartialViewResult>();
        }
        public async Task CreateProductCategory_Success_ReturnStatusCodeCreated()
        {
            IHttpActionResult result = await productController.AddCategory(
                new Guid("223913df-203a-41e2-83a9-94343ee5d434"), new ProductCategoryInsertViewModel()
            {
                Categories = new List <Guid>()
                {
                    new Guid("223913df-203a-41e2-83a9-94343ee5d434"),
                    new Guid("5579b911-2392-43f8-87cf-83e1a7bbed6f")
                }
            });

            HttpJsonApiResult <IEnumerable <object> > contentResult = result as HttpJsonApiResult <IEnumerable <object> >;

            Assert.AreEqual(HttpStatusCode.Created, contentResult.StatusCode);
        }