Less brittle tests with SQL Server CE

Posts   
 
    
Posts: 497
Joined: 08-Apr-2004
# Posted on: 02-Jun-2010 23:25:00   

Hi,

I am writing a repository class which is returning EntityCollection's, and I want to test my code out with a mocked out repository, so that I don't have any unpleasant brittle dependencies on the database.

The way i do this usually is to mock the repository and in my mocks, return a hand coded entity collection for the tests. However, some of my graphs are quite deep now, and this is getting pretty tedious. So, I was thinking that a nice alternative would be to use a "local" SQL Server Compact Edition database complete with the same tables and some test data, and in my test project set the connection string to this database file.

The LLBLGen gen'd code is fed from a SQL Server 2005 database, so before i spend a lot of time setting up a SQL Server CE "mini" database, I wanted to check if this is going to work, or if it will fail because I need to re-generate the code off the SQL Server CE database using different settings....

Thanks

Matt

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 03-Jun-2010 04:12:43   

Hi Matt,

Did you mean SQL CE Desktop, right? Yes, It should work that way. As a matter of fact LLBLGen Pro (since v2.6) uses the normal SqlServer DQE assembly for query production for CE Desktop, so you don't have to make changes on your assembly reference. You just need to make the change on your connection string and sql compatibility level. Please read this for more information.

Some features wont be available in CE Desktop though (Stored procedures, multiple catalogs, multiple schemas).

David Elizondo | LLBLGen Support Team
Posts: 497
Joined: 08-Apr-2004
# Posted on: 03-Jun-2010 13:06:59   

Ace! I'll give it a go and let you all know how it goes here once done.