How can I stub IDBconnection
问题 I am writting Unit Test for my database connection. I have following class Public class A { public IDbConnection _dbConnection; public A() { _dbConnection = new SqlConnection(connectionStringName); } public int ExecuteNoneQuery(CommandDefination command) { return _dbConnection.Execute(command); } } I want to test this class, how I can test with Microsoft Stub/Shim I have written following code, but it is not working. [TestMethod] public void TestMethod1() { StubIDbConnection stubIDbConnection