Unit Testing VS 2008 Using Excel
- by David
When using Excel (2003) to provide data for my unit tests it seems to think that when a cell has TRUE / FALSE value that it is null when there has been no preceding cell values e.g.
if (TestContext.DataRow["SatisfactionExtremelySatisfied"] != DBNull.Value)
model.SatisfactionExtremelySatisfied = (bool)TestContext.DataRow
["SatisfactionExtremelySatisfied"];
Sample Excel Data
DataRow SatisfactionExtremelySatisfied
0
1
2 TRUE
3 TRUE
When reading the test data using OLEDB the cells with TRUE hold no value but when the preceding cells have the value FALSE entered it correctly gets the values TRUE.
Am I missing something?