How do I add a fakes assembly in VS 2012 Professional RC?

Update: VS2012 Update 2 will include Fakes support in Premium. See http://blogs.msdn.com/b/bharry/archive/2013/01/30/announcing-visual-studio-2012-update-2-vs2012-2.aspx I asked this question in the Microsoft Connect portal…and the answer is disappointing: The RC documentation was incorrect. Fakes are available only in VS Ultimate. I have passed your concerns on the Fakes team. At the moment, we don’t have any information about … Read more

How to pass in a mocked HttpClient in a .NET test?

You can replace the core HttpMessageHandler with a fake one. Something that looks like this… public class FakeResponseHandler : DelegatingHandler { private readonly Dictionary<Uri, HttpResponseMessage> _FakeResponses = new Dictionary<Uri, HttpResponseMessage>(); public void AddFakeResponse(Uri uri, HttpResponseMessage responseMessage) { _FakeResponses.Add(uri, responseMessage); } protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) { if (_FakeResponses.ContainsKey(request.RequestUri)) { return Task.FromResult(_FakeResponses[request.RequestUri]); } else … Read more