Controllers.HomeController.Index C# (CSharp) Method

Index() public method

public Index ( ) : System.Web.Mvc.ActionResult
return System.Web.Mvc.ActionResult
        public ActionResult Index()
        {
            ViewData ["Message"] = "Welcome to ASP.NET MVC on MonoDevelop!";

            return View ();
        }

Usage Example

        public void tewwet()
        {
            var productRepository = new Moq.Mock<IProductRepository>();
            productRepository.Setup(x => x.Get())
                             .Returns(new[]
                                          {
                                              new Product()
                                                  {
                                                      ID = 1,
                                                      Title = "iPad",
                                                      Description = "Fruit based tablet",
                                                      UnitPrice = 450
                                                  },
                                              new Product()
                                                  {
                                                      ID = 2,
                                                      Title = "iPhone",
                                                      Description = "Fruit based phone",
                                                      UnitPrice = 500
                                                  }
                                          });

            var homeController = new HomeController(productRepository.Object);

            var result = homeController.Index() as ViewResult;

            Assert.NotNull(result.Model);
        }
HomeController