How to mock IDataReader to test method which converts SqlDataReader to System.DataView
问题 I'm new to Moq and I'm struggling to write Unit Test to test a method which converts SqlDataAdapter to System.DataView . This is my method: private DataView ResolveDataReader(IDataReader dataReader) { DataTable table = new DataTable(); for (int count = 0; count < dataReader.FieldCount; count++) { DataColumn col = new DataColumn(dataReader.GetName(count), dataReader.GetFieldType(count)); table.Columns.Add(col); } while (dataReader.Read()) { DataRow dr = table.NewRow(); for (int i = 0; i <