tags:

views:

17

answers:

1

Hi,

I have an application which consumes a WCF Service. I have no access to the source code to the service I'm consuming and I can't connect to it directly as it's internal to part of a companies network.

I have the necessary Service Reference and a number of sample XML requests and responses. What I'd like to know is how can I create/mock a service response from these XML files for testing? Or is there an alternative?

Thanks, JJ

+1  A: 

Service reference should contain all necessary contracts. So you should be able to create fake implementation of the service from its service contract and related data contracts. But your client code can't access service proxy directly. Wrap service access in wrapper class implementing service contract and inject that wrapper into your client code. Than you can easily mock that wrapper.

Ladislav Mrnka