Faking out WebClient

I spent an hour or two to find this correct solution for how to unit test System.Net.WebClient in Visual Studio 2012.  I found one page that actually had a minor typo in the implementation that caused me quite of a bit of aggravation.  I won’t link to it, cause I don’t want to bump it up higher on Google.  Here’s what my System.Fakes looks like:

<Fakes xmlns=”http://schemas.microsoft.com/fakes/2011/”>
<Assembly Name=”System” Version=”″/>
<Add FullName=”System.Net.WebClient”/>

I’ve been experimenting with writing unit tests as I write my code.  I find it a very organic way of development and makes the unit tests almost free.  My experience so far is that unit tests are best for back end testing.

Comments are Disabled