public void RetailersController_Details_isValid()
        {
            RetailersController controller = new RetailersController();

            ViewResult result = controller.Details(1) as ViewResult;
            Retailer RetailerResult = (Retailer)result.Model;

            Assert.AreEqual(1, RetailerResult.retailerID);
        }
        public void RetailersController_Details_isNotValid()
        {
            RetailersController controller = new RetailersController();

            HttpNotFoundResult result = controller.Details(9999999) as HttpNotFoundResult;
            var expectedResult = new HttpNotFoundResult().GetType();

            Assert.IsInstanceOfType(result, expectedResult);
        }
        public void RetailersController_Create_isNotValid()
        {
            Retailer testRetailer = new Retailer();
            testRetailer.retailerName = "invalidRetailer";
            RetailersController controller = new RetailersController();
            controller.ModelState.AddModelError("", "error message");

            var result = controller.Create(testRetailer) as ViewResult;
            Retailer resultRetailers = (Retailer)result.Model;

            Assert.AreEqual("invalidRetailer", resultRetailers.retailerName);
        }
        public void RetailersController_Create_isValid()
        {
            Retailer testRetailer = new Retailer();
            testRetailer.retailerName = "testRetailer";
            testRetailer.retailerEmail = "*****@*****.**";
            testRetailer.retailerContactName = "testContact";

            RetailersController controller = new RetailersController();

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

            Assert.AreEqual("Index", result.RouteValues["action"]);
        }
        public void RetailersController_Index()
        {
            RetailersController controller = new RetailersController();

            ViewResult result = controller.Index() as ViewResult;

            Assert.IsNotNull(result.Model);
        }