public void test_create()
        {
            var controller = new ProductsController(new ProductBLL(new ProductStub()));

            var result = (ViewResult)controller.Create();

            Assert.AreEqual(result.ViewName, "");
        }
        public void test_post_create2()
        {
            var controller = new ProductsController(new ProductBLL(new ProductStub()));

            var prod = new Product();
            controller.ViewData.ModelState.AddModelError("prouctname", "No product name");

            var result = (ViewResult)controller.Create(prod);

            Assert.IsTrue(result.ViewData.ModelState.Count == 1);
            Assert.AreEqual(result.ViewName, "");
        }
        public void test_post_create()
        {
            var controller = new ProductsController(new ProductBLL(new ProductStub()));

            var prod = new Product()
            {
                ProductId = 1,
                CategoryId = 1,
                Name = "llll",
                Price = 213,
                ProductPicUrl = "/Content/Images/placeholder.gif"
            };

            var result = (RedirectToRouteResult)controller.Create(prod);

            Assert.AreEqual(result.RouteName, "");
            Assert.AreEqual(result.RouteValues.Values.First(), "Index");
        }