public void Category_Edit_NoIdentifierFound()
        {
            //Arrange
            var controller = new CategoryController(new CategoryBLL(new CategoryRepoStub())
                , new AccountBLL(new AccountRepoStub()));

            var sessionMock = new TestControllerBuilder();
            sessionMock.InitializeController(controller);
            controller.Session["Admin"] = true;

            string categoryName = "test name";
            string categoryId = "2";

            //Act
            var viewResult = controller.Edit(categoryId, categoryName) as ViewResult;

            //Assert
            Assert.AreEqual("Error", controller.ViewBag.Title);
            Assert.AreEqual("Cannot perform admin tasks without a valid email", controller.ViewBag.Message);
            Assert.AreEqual("~/Views/Shared/Result.cshtml", viewResult.ViewName);
        }
        public void Category_Edit_NotAdmin()
        {
            //Arrange
            var controller = new CategoryController(new CategoryBLL(new CategoryRepoStub())
                , new AccountBLL(new AccountRepoStub()));

            var sessionMock = new TestControllerBuilder();
            sessionMock.InitializeController(controller);
            controller.Session["Admin"] = false;
            controller.Session["Email"] = "ole";

            string categoryName = "test name";
            string categoryId = "2";

            //Act
            var viewResult = controller.Edit(categoryId, categoryName) as ViewResult;

            //Assert
            Assert.AreEqual("Error", controller.ViewBag.Title);
            Assert.AreEqual("Only administrators can edit categories", controller.ViewBag.Message);
            Assert.AreEqual("~/Views/Shared/Result.cshtml", viewResult.ViewName);
        }
        public void Category_Edit_InvalidInput()
        {
            //Arrange
            var controller = new CategoryController(new CategoryBLL(new CategoryRepoStub())
                , new AccountBLL(new AccountRepoStub()));

            var sessionMock = new TestControllerBuilder();
            sessionMock.InitializeController(controller);
            controller.Session["Admin"] = true;
            controller.Session["Email"] = "admin";

            string categoryName = "test name";
            string categoryId = "-1";

            //Act
            var viewResult = controller.Edit(categoryId, categoryName) as ViewResult;

            //Assert
            Assert.AreEqual("Error", controller.ViewBag.Title);
            Assert.AreEqual("Could not update the category", controller.ViewBag.Message);
            Assert.AreEqual("~/Views/Shared/Result.cshtml", viewResult.ViewName);
        }