I’m trying to use WebRequest.RegisterPrefix to register a decorator IWebRequestCreate implementation with the intention being to add “debug” scenarios (like emulating different connectivity scenarios).
I’m using the Mango beta 2 SDK and the RegisterPrefix method always returns true when used with “http://” as a prefix (or “http” for that matter), but the registered IWebRequestCreate instance is not being used.
I can see from the documentation that it should return false for duplicates, but it doesn’t seem to be functioning as documented.
Is there any other way of achieving what I’m after in a way that is transparent to consumers?
I’m using
WebRequest.RegisterPrefixfor unit testing, registering anIWebRequestCreateimplementation for a prefix oftest://, and this does work.I found that after registering an
IWebRequestCreateforhttp://, callingWebRequest.Createwith anhttp://uri would return a request created from the registeredIWebRequestCreate, but callingWebRequest.CreateHttpwould still return anHttpWebRequest.The following code should verify this, and I’m using the Mango Beta 2 SDK (6-29-11):