public void AdminCookieWarningAddItem()
        {
            MockContext mockContext = new MockContext();
            mockContext.Cookies.Add(new HttpCookie("UserSettings", "Role=SystemAdmin"));
            var homeController = new HomeController()
            {
                ControllerContext = new ControllerContext()
                {
                    HttpContext = mockContext.Http.Object
                }
            };

            //act
            var result = homeController.AddItem(1) as ViewResult;
            Assert.AreEqual("There is already an existing item with this name.", result.ViewBag.ErrorMessage);
        }
        public void AdminCookieAddItem()
        {
            MockContext mockContext = new MockContext();
            mockContext.Cookies.Add(new HttpCookie("UserSettings", "Role=SystemAdmin"));
            var homeController = new HomeController()
            {
                ControllerContext = new ControllerContext()
                {
                    HttpContext = mockContext.Http.Object
                }
            };

            //act
            var result = homeController.AddItem() as ViewResult;
            Assert.AreEqual("AddItem", result.ViewName);
        }
        public void NoCookieAddItem()
        {
            MockContext mockContext = new MockContext();
            var homeController = new HomeController()
            {
                ControllerContext = new ControllerContext()
                {
                    HttpContext = mockContext.Http.Object
                }
            };

            //act
            var result = homeController.AddItem() as RedirectToRouteResult;
            Assert.AreEqual("Index", result.RouteValues["Action"]);
        }
        public void CustomerStaffCookieAddItem()
        {
            MockContext mockContext = new MockContext();
            mockContext.Cookies.Add(new HttpCookie("UserSettings", "Role=Staff"));
            var homeController = new HomeController()
            {
                ControllerContext = new ControllerContext()
                {
                    HttpContext = mockContext.Http.Object
                }
            };

            //act
            var result = homeController.AddItem() as RedirectToRouteResult;
            Assert.AreEqual("Index", result.RouteValues["Action"]);
        }