Today I finally had to create a mock of a web service proxy,
what fun. Of course the first go at it
failed because I did not think about the fact that the web service proxy is NOT
serializable. This sucked, so what was I
Well, fortunately for me web service proxy classes are partial’s,
so I am able to ‘tweek’ the class.
Basically what I did was created a new partial class on my
web service proxy as well as an interface for the partial class. I then went in to my consuming code for the
web service and modified it to use the interface, not the concrete class. After these simple changes, I can now mock my
web service when needed and use the actual at run time.
Creating the interface for my web service
Implementing the interface on my new partial class
Creating the test
BTW, if there is a better, easier way to do this, please let
07-05-2007 8:09 AM