Esempio n. 1
0
        public void ProductIsBling()
        {
            //Arrange
            ProductModel   model      = new ProductModel();
            ShopController controller = new ShopController(model);
            //Act
            ViewResult result = controller.Product();

            Assert.AreEqual("Bling!", result.ViewBag.SubTitle);
        }
Esempio n. 2
0
        public void ProductName()
        {
            //Arrange
            ProductModel   model      = new ProductModel();
            ShopController controller = new ShopController(model);

            //Act
            ViewResult   viewResult = controller.Product();
            ProductModel result     = viewResult.Model as ProductModel;


            //Assert
            Assert.AreEqual("Iphone 6", result.Name);
        }
Esempio n. 3
0
        public void IndexWelcomeMessage()
        {
            //Arrange
            ProductModel   model      = new ProductModel();
            ShopController controller = new ShopController(model);


            //Act
            ViewResult result = controller.Index();


            //Assert
            Assert.AreEqual("Welcome to the shop!. Kindly spend all your money with us!",
                            controller.ViewBag.WelcomeMessage);
        }
Esempio n. 4
0
        public void ProductIsCheapAndNasty()
        {
            //Arrange
            ProductModel model = new ProductModel();

            model.Name        = "Test Product 1";
            model.Description = "Description of Test Product 1";
            model.Price       = 2.99M;

            //Inject the controller's dependency on the model so we can test it
            ShopController controller = new ShopController(model);

            //Act
            ViewResult result = controller.Product();

            Assert.AreEqual("Cheap and nasty product!", result.ViewBag.SubTitle);
        }