public void CreateModelInvalid()
        {
            var controller = new ItemCategoriesController(new CategoryBLL(new CategoryServiceStub()));
            var forventet = new ItemCategory();
            controller.ViewData.ModelState.AddModelError("CategoryName", "");

            var actionResult = (ViewResult)controller.Create(forventet);
            Assert.AreEqual(actionResult.ViewName, "");
        }
        public void CreateModelOK()
        {
            var controller = new ItemCategoriesController(new CategoryBLL(new CategoryServiceStub()));
            var forventet = new ItemCategory
            {
                CategoryId = 1,
                CategoryName = "TestCategory"
            };

            var actionResult = (RedirectToRouteResult)controller.Create(forventet);

            Assert.AreEqual(actionResult.RouteName, "");
            Assert.IsTrue(actionResult.RouteValues.Values.Count == 1);
            Assert.AreEqual(actionResult.RouteValues.Values.First(), "Index");
        }
 public void CreateGetView()
 {
     var controller = new ItemCategoriesController(new CategoryBLL(new CategoryServiceStub()));
     var actionResult = (ViewResult)controller.Create();
     Assert.AreEqual(actionResult.ViewName, "");
 }