title: ASP.NET MVC unit testing with MOQ object
body: <p>What is the best way to mock below code in unit testing:</p>
  
  <pre><code>public ActionResult Products()
  {
        ViewBag.Title = "Company Product";                        
        IEnumerable&lt;ProductDetailDto&gt; productList =   ProductService.GetAllEffectiveProductDetails();
        ProductModels.ProductCategoryListModel model = new ProductModels.ProductCategoryListModel 
        {     
              //the type of ProductDetails =&gt; IEnumerable&lt;productDetailDto&gt;  
              ProductDetails = ProductService.GetAllEffectiveProductDetails(),
  
              //the type of ProductCategoryList =&gt; IEnumerable&lt;selectlistitem&gt;
              ProductCategoryList = productList.Select(x =&gt; new SelectListItem
              {
                  Value = x.FKProductId.ToString(),
                  Text = x.Name
              })
        };
        return View(model);
  }
  </code></pre>
  
  <p>FYI, I am working on VS 2012, MVC 4.0, Unit Testing with MOQ object and TFS setup.</p>
  
  <p>Can anyone help me out on this what is the best test method with mock object for above method?</p>