-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME
More file actions
13 lines (7 loc) · 788 Bytes
/
README
File metadata and controls
13 lines (7 loc) · 788 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
Since SqlCommand is a sealed class, you cannot mock it. What do you do if you want to put your database calls under test? This is just one example of what can be done. There is a bit of smoke and mirrors where one section isn't really under test.
The biggest benefit is you can simulate the response from sql as close to the wire as possible.
I have not added a full compliment of tests and error handling, but this is a sample to start from.
Both the Console App and the Unit Tests can be run. You will need to create a database, the scritps are in the DatabaseScripts folder.
The object returned from Sql is nested Xml.
I am using the GetValue(0) vs using Xml. That would require using an XmlReader, which is not supporeted under the IDbCommand interface.
A change test.