Hi Scot
OK we got few issues here:
1. The method ExecuteReader returns SqlDataReader object so you need to mock SqlDataReader object. The problem is that SqlDataReader has only private constructor so the line should look like this:
MockObject mockReader = MockManager.MockObject(typeof(SqlDataReader), Constructor.Mocked, null, null);
2. In order to to get the mocked object you should use the Object property of MockObject class. So the next line should look like this:
MockManager.MockAll(typeof(SqlCommand)).ExpectAndReturn("ExecuteReader", (SqlDataReader)mockReader.Object, 1);
3. And finally you need to mock the Close method of SqlConnection class or else you will get a nasty exception in your ReadMethod.
And here is the full code:
[Test]
public void TestIt()
{
MockManager.Init();
Mock mockSqlCon = MockManager.MockAll(typeof(SqlConnection));
mockSqlCon.ExpectCall("Open");
mockSqlCon.ExpectCall("Close");
MockObject mockReader = MockManager.MockObject(typeof(SqlDataReader), Constructor.Mocked, null, null);
MockManager.MockAll(typeof(SqlCommand)).ExpectAndReturn("ExecuteReader", (SqlDataReader)mockReader.Object, 1);
new ReaderClass().ReadMethod();
}