Mocking WebResponse’s from a WebRequest
I found this question while looking to do exactly the same thing. Couldn’t find an answer anywhere, but after a bit more digging found that the .Net Framework has built in support for this. You can register a factory object with WebRequest.RegisterPrefix which WebRequest.Create will call when using that prefix (or url). The factory object … Read more