views:

286

answers:

4

I'm utilizing the Reporting Services web service to generate a report and allow the user to download it. This is occuring via PDF, Excel, XML, etc. and working just fine. I'm trying to create some seperation between my reporting class and the implementation, but am struggling with how I can can do this in a manor that is still testable.

Since my custom Reports Object/Class is calling the web service directly, should I seperate this out even further with the use of interfaces? Any reccomendations on this and how it would still be unit testable regardless of the byte source would be much appreciated.

+1  A: 

So much for a quick and easy solution eh?

Thanks Jeff. I'll get busy reading...

RSolberg
+1  A: 

If you're new to Dependency Injection/Inversion of Control, this link is a great screencast by Carl Franklin and James Kovacs.

DNR TV Show #126: James Kovacs' roll-your-own IoC container

I'm a sucker for learning new things by hearing others explain it clearly and watching them code it. James explains the principles, the code that does it, and how you can further your study by using a framework.

AndrewDotHay
+1  A: 

As mentioned, Dependency Injection/Inversion of Control is the way to go. Code to an interface rather than a concrete class. Then, when your unit test runs it can swap the web service implementation with a mock implementation that returns fake, fixed data.

davogones