title: How can I stub IDBconnection
body: <p>I am writting Unit Test for my database connection.</p>
  
  <p>I have following class</p>
  
  <pre><code>Public class A
  {
      public IDbConnection _dbConnection;
  
      public A()
      {
         _dbConnection = new SqlConnection(connectionStringName);
      }
  
      public int ExecuteNoneQuery(CommandDefination command)
      {
         return _dbConnection.Execute(command);
      }
  }
  </code></pre>
  
  <p>I want to test this class, how I can test with Microsoft Stub/Shim</p>
  
  <p>I have written following code, but it is not working.</p>
  
  <pre><code>[TestMethod]
  public void TestMethod1()
  {
      StubIDbConnection stubIDbConnection = new StubIDbConnection();
      stubIDbConnection.Execute =(null) =&gt; -1;
      var a = new classA();
      int answer = a.ExecuteNoneQuery(null);
      Assert.AreEqual(-1, answer);
  
   }
  </code></pre>