tags:

views:

1887

answers:

1

I wish to test and observe timeout behaviours between a WCF client and service host. For receiveTimeout and sendTimeout, it is probably easy to transmit a large byte stream that takes more than a few seconds and set those timeout attributes to ridiculously low values.

However, since there is nothing that can be done beyond the calling of a serviceProxy.Open() or .Close() methods, I am thinking what is a good way to delay the opening and closing of WCF connections, to cross the thresholds of openTimeout and closeTimeout?

A: 

Well, if you have exposed your contracts correctly (as interfaces), you can mock an instance of the proxy which throws TimeoutException and pass it to your code for use.

casperOne