This might sound strange but exactly this is what I want to do: I have a TestMehod Currency_ReadItem_Test() which tests ReadItem() method in Currency class. This ReadItem() takes IDataReader object as an parameter and fills local data members in the class.
Now the problem is I want to test this ReadItem() in my TestMethod which has a Excel Sheet DataSource. Any idea how can I first fill my Reader from Excel sheet so that it can be passed to this function in oder to test it?
Any help would be appreciated.
Thanks
One way is to read the spreadsheet via ADO.NET - then you just use ExecuteReader
for some query you define.
Alternatively, you could use the Excel API and load the data you want into a DataTable
, and then use a DataTableReader
. Or if you don't like DataTable
and you know for sure the schema of the data (i.e. fixed and rigid) you could also populate a List<SomeType>
and use ObjectReader
from "FastMember" (open source)