Actually, in your specific case, doesn't 

    MockRepository.GeneratePartialMock(typeof(SqlDataReader), new Type[0], 
arguments)

do the trick?

I'm assuming your IDataReader is an SqlDataReader, but could be your 
specific IDataReader implementation.


On Tuesday, October 9, 2012 1:14:44 PM UTC+1, Алик Ким wrote:
>
> Hi!
>
> I got an object of IDataReader. Need to make some changes to the result of 
> its GetSchemaTable method. And want the object to act like it acts usual in 
> all other cases. Can I somehow wrap that existing object using rhino mocks?
>
>
> Details:
> in out unit tests we create DataTable programmatically, then provide a 
> code to be tested with result of its "CreateDataReader()" method, which 
> returns IDataReader.
> I didn't find way to set precision and scale for a decimal column of 
> DataTable. As far as I see the only way to emulate them is to create a 
> wrapper around the IDataReader object which wil delegate all actions , but 
> will allow to make changes to schema info table inside GetSchemaTable
>
>
> I can achive such wrapping manually: make a StubDataReader class, which 
> will delegate all calls to an existing instance of IDataReader. But I think 
> a new class with about 20 stub methods is not a good way :(
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Rhino.Mocks" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/rhinomocks?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to