Following up on my Simple.Data Faking experiment

A couple of weeks ago I blogged about an idea I had for mocking (and / or stubbing) database results from Simple.Data.
Since then I've attempted to write out my ideas, and I've gotten the project into a state where it actually is usable for some cases.
In short this post will be explaining how to use Simple.Data.FakeResult.


Mocking database integration with Simple.Data

I just discovered what might be a super-duper-happy-path to mocking database integration using the Simple.Data framework.
Mocking Db integration seems to be a constant source of frameworks and practices. And now I've got one myself.

Some context

The Simple.Data framework allready provides an XML mocking provider that allows you to define data in xml that later can used as a datasource.
Using this provider can be rather cumbersome as you have to define all your data up front in XML.
Simple.Data is based the .Net 4 dynamic realm, and all return values are allways dynamic. This fact provides us the freedom to simply replace whatever Simple.Data returns, with our own mock data.
The only requirement is that the call to Database.Openxxx is abstracted into som kind of wrapper, as the starting poin in Simple.Data is a static factory class (Simple.Data.Database) and thus it cannot be intercepted.


Subscribe to RSS - Simple.Data.FakeResult