title: How reliable is Verify() in Moq?
body: <p>I'm only new to Unit Testing and ASP.NET MVC. I've been trying to get my head into both using Steve Sanderson's "Pro ASP.NET MVC Framework". In the book there is this piece of code:</p>
  
  <pre><code>public class AdminController : Controller
  {
   ...
  
      [AcceptVerbs(HttpVerbs.Post)]
      public ActionResult Edit(Product product, HttpPostedFileBase image)
      {
        ...
         productsRepository.SaveProduct(product);
  
         TempData["message"] = product.Name + " has been saved.";
         return RedirectToAction("Index");
      }
  }
  </code></pre>
  
  <p>That he tests like so:</p>
  
  <pre><code>[Test]
  public void Edit_Action_Saves_Product_To_Repository_And_Redirects_To_Index()
  {
      // Arrange
      AdminController controller = new AdminController(mockRepos.Object);
  
      Product newProduct = new Product();
  
      // Act
      var result = (RedirectToRouteResult)controller.Edit(newProduct, null);
  
      // Assert: Saved product to repository and redirected
      mockRepos.Verify(x =&gt; x.SaveProduct(newProduct));
      Assert.AreEqual("Index", result.RouteValues["action"]);
  }
  </code></pre>
  
  <p>THE TEST PASSES.</p>
  
  <p>So I intentionally corrupt the code by adding "productsRepository.DeleteProduct(product);" after the "SaveProduct(product);" as in:</p>
  
  <pre><code>            ...
         productsRepository.SaveProduct(product);
         productsRepository.DeleteProduct(product);
              ...
  </code></pre>
  
  <p>THE TEST PASSES.(i.e Condones a calamitous [hypnosis + intellisense]-induced typo :) )</p>
  
  <p>Could this test be written better? Or is there something I should know? Thanks a lot.</p>