Correctly, at the prompt of Philip, I reply that I went alone, and perhaps came up with a working solution. Using WSDL.exe, I created interfaces (using the / si switches) and regular proxy classes and added both to my business project.
Then I created a new class that inherits from a particular class AND implements the interface. This small class did not contain any code at all, since the inherited specific members provided implicit implementation of the interface members. The code was compiled first, and I was able to replace this small “pad” (? Adapter?) With a Class with my integration tests and make calls against a direct third-party server.
Now I can create other classes (mocks or fakes) that implement the interface, and replace them instead of the "shim" class.
Edit: Well, I worked a bit on this and did not allow a few complications that it works.
The first major issue is that proxy classes are still marked as “internal”, so the derived class (adapter / strip) must also be internal. This is not a problem if you put the Factory class in your business project / assembly that updates the proxy classes and returns them as an interface.
The second problem that I discovered was that we explicitly specified the URL and timeout properties of the web page, but they are not included in the interface, and are not inherited from System.Web.Services.Protocols.WebClientProtocol via SoapHttpClientProtocol. Again, I dealt with this in a factory, since this is a detail of the implementation that I'm happy about, not in the interface.
Edit: This still works well for me during the testing and development of our facade. Since I get the proxy server behind the interface, I also created a log decorator class that captures many sample calls to use debugging and when the third-party server is down.
I wrote what I did a bit more here: http://www.flowerchild.org.uk/archive/2010/09/21/mocking-or-faking-or-maybe-stubbing-a-wsdl-exe-soap .html
Andrew M
source share