Mercurial > silverbladetech
view Stocks/Stocks.Common/WebClientShim.cs @ 6:c812bca7b1ac
"Restore packages on build" enabled by Nuget 1.6
General refactoring based on code analysis
author | stevenh7776 stevenhollidge@hotmail.com |
---|---|
date | Tue, 21 Feb 2012 01:00:34 +0700 |
parents | 57f20ba55884 |
children | 6e84a4c92378 |
line wrap: on
line source
using System.Net; using System; namespace Stocks.Common { // Shim to wrap WebClient component to allow the shim to // be mocked or stubbed for unit tests. // Favours injection and composition over inheritence public class WebClientShim : IWebClientShim { private WebClient _webClient; public WebClientShim(WebClient webClient) { _webClient = webClient; } // add event handlers to the shim if you wish // to hook into DownloadStringCompleted event public string DownloadString(string address) { return _webClient.DownloadString(address).ToString(); } public void Dispose() { _webClient.Dispose(); } } }