Skip to content

CtcApi.Web

Shawn (work acct) edited this page Jun 8, 2013 · 2 revisions

Simulating Session state

See Simulating Session state for unit testing, etc. under CtcApi.Web.Mvc

DummyWebResponse

The DummyWebResponse is simply a sub-classed WebResponse object. I can be useful for determining the state of the code at run-time - by checking the Type of the WebResponse returned from a method.

 WebResponse response = new DummyWebResponse();

 ...

 if (enableHttp)
 {
   response = request.GetResponse();
 }

 ...

 if (response is DummyWebResponse)
 {
   // No action was taken because HTTP was disabled.
 }
Clone this wiki locally