R – How to mock ADO.Net Dataservice calls from Silverlight

mockingsilverlightunit testingwcf-data-services

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?

Best Answer

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.