views:

396

answers:

2

Has anyone found a good method of mocking out ADO.Net Data Service calls from a Silverlight application?

The power of Data Services seems to be the use of linq, client side, over entities. However when testing the objects that do the data access how can you mock out the service?

One way is to create an entire mock Data Service, but then all the objects would need to be recreated.

Are there any mocking frameworks that can help?

+1  A: 

I understand, but one of the advantages of using ADO.Net Data Services appears to be that you get your entity objects for free. But if you can't mock the service it's calling this doesn't help.

Maybe one way is to pass in a different uri, but it would presumably still not all the same objects?

If you end up writing new interfaces or facades to hide the objects it feels like you've lost everything that has been gained?

jbloomer
A: 

If you created your own interfaces and wrappers for the services you wouldn't have to mock the actual objects returned by the service.

So you might have an ICustomerRepository that wraps the ADO.NET data service that exposes your Customer table. You could then mock the ICustomerRepository but still return the same Customer objects that the data service returns.

Jeremy Wiebe