Simple.Data 2.0 - Unit Test Sample

35 views
Skip to first unread message

Michael Draper

unread,
Aug 22, 2015, 9:17:26 PM8/22/15
to Simple.Data
Hi all - I am trying to figure out how to use an in-memory database with Simple.Data 2.0. Can anyone lend me a hand with basic syntax on setting it up?

Thanks in advance!

Michael Draper

unread,
Aug 23, 2015, 1:02:36 PM8/23/15
to Simple.Data
Really I'm looking for basic strategy for unit testing functions that hit Simple.Data objects. 

So if I have a function that makes a simple.data call I want to make sure that the right parameters are being passed into Simple.Data and that the outer function resolves with the expected values with given fixed results.


Mike Woods

unread,
Aug 23, 2015, 1:24:30 PM8/23/15
to Simple.Data
The way we tackle that is to wrap the Simple.Data call in a protected virtual method.  That allows your test class to inherit from the class you're test, specify your own behavior for the database call, and still unit test all the other non-data access code.

Mike Woods

unread,
Aug 24, 2015, 3:35:49 PM8/24/15
to Simple.Data
Hey Michael,
I actually happened to run across this today which would make it even easier.

http://simplefx.org/simpledata/docs/pages/Test/Basics.htm

That has the syntax for exactly what you're requesting.  


On Sunday, August 23, 2015 at 12:02:36 PM UTC-5, Michael Draper wrote:
Reply all
Reply to author
Forward
0 new messages