I'm working with Subsonic's SimpleRepository, and I'm trying to write some unit tests so they don't touch the database, but I'm having trouble figuring out if SimpleRepository can work against in-memory lists (Like the active record can) instead of an actual database.
I would like to do the following:
//setup test data
var repo=new SimpleRepository();
var key=repo.Add(new Post {Title = "Test Title", Author = "Test Author"});
//later, a the following would be called and should return the post
var post = repo.Single<Post>(key);
This should all happen in memory.
You can, however, implement IRepository (which SimpleRepository implements) and use it instead of the SimpleRepo (which you should do anyway). Then you can mock it/fake it as needed.