I\'m new to moq and setting up mocks so i could do with a little help. How do I mock up an SqlDataReader using Moq?
Update
After further testing this is what I h
I was just trying to figure this out myself. Not sure if this is new functionality in Moq, but it appears there is a simpler way than @Monsignor's answer.
Use Moq's SetupSequence
method. Your code simply becomes:
private IDataReader MockIDataReader()
{
var moq = new Mock();
moq.SetupSequence( x => x.Read() )
.Returns( true )
.Returns( false );
moq.SetupGet