Hi,
I've created an extension method for SqlCommand that allows some additional work before executing the command:
public static SqlDataReader ExecuteMyReader( this SqlCommand sqlCommand )
{
// Some calculations here
return sqlCommand.ExecuteReader();
}
My question is what is the best way to unit test this extension method?
Should I test it directly against a database?
Or should I try and create a mock object? If this is the case I've tried doing this through Moq but as SqlCommand is a sealed class I can't seem to mock it.
Thanks