title: How to remove error come during execution of unit test in vs 2012
body: <pre><code>    [TestMethod]
      public void Index1()
      {
          MovieDBContext db = new MovieDBContext();
  
              //Arrange
              MoviesController mv = new MoviesController();
              //Act
              ViewResult result = mv.Index() as ViewResult;
              //Assert
              Assert.AreEqual(result.ViewName, "Index");
  
  
      }
  </code></pre>
  
  <p>//Controller Method is and db object create in same controller as method (Index) exist</p>
  
  <p>public ActionResult Index()
          {</p>
  
  <pre><code>        return View(db.Movies.ToList());
      }
  </code></pre>
  
  <p>//Error come as
  An exception occurred while initializing the database. See the InnerException for details.</p>