Click here to Skip to main content
15,878,959 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want to configure the unit tests to run for a predefined set of data but do not want to define those in external database/file. Reason being - it's a simple data collection that would make sense to be visible right in the test .cs file. Is there any way you can configure the datasource to a collection/dictionary in memory.

What I have tried:

I am able to use the unittests datasource to an external database (please refer to think link: https://msdn.microsoft.com/en-us/library/ms182527.aspx). I would like to pull the data from dictionary instead of it being loaded from database/files to simplify things.
Posted
Updated 15-Feb-16 19:45pm
v2
Comments
BillWoodruff 7-Feb-16 11:23am    
"in-memory dictionary" if you create a Dictionary, and add KeyValuePairs to it, how could that not be "in memory" ?

"a datasource" for ... what ? Controls ? DataGridView ?
Chandra Mohan BS 16-Feb-16 1:44am    
Sorry for the delay and thanks for your comment Bill.
I was referring to the datasource attribute for unit tests. Please see this link: https://msdn.microsoft.com/en-us/library/ms182527.aspx. Here they are using a "table" of values and sum and loading that from database. I want to have that in memory and not load from a db.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900