2

How do you mock old web services (not WCF) with Rhino Mocks, I can find plenty on WCf but not the old ones?

1
  • Do you mean asmx pages? And are you talking about doing mocking inside the asmx page or doing some kind of mock for consumers of those asmx pages? Mar 29, 2012 at 20:19

1 Answer 1

3

To mock a Web Service, you have to extract an interface from the generated web service code (reference.cs), and make the web service code inherit from that interface. You could make the web service "reference.cs" implement the interface, but may kill that code when you "update web reference". The trick is to add a second "partial class" that will inherit from that interface.

Then you mock the interface, Gah, why didn't i think of this earlier

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.