Mercurial > silverbladetech
comparison MetroWpf/Stocks.Common/WebClientShim.cs @ 20:6109bc268b90
Latest
author | adminsh@apollo |
---|---|
date | Tue, 20 Mar 2012 13:37:46 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
19:09d18d6e5f40 | 20:6109bc268b90 |
---|---|
1 using System.Net; | |
2 using System; | |
3 | |
4 namespace Stocks.Common | |
5 { | |
6 // Shim to wrap WebClient component to allow the shim to | |
7 // be mocked or stubbed for unit tests. | |
8 // Favours injection and composition over inheritence | |
9 public class WebClientShim : IWebClientShim | |
10 { | |
11 private WebClient _webClient; | |
12 | |
13 public WebClientShim(WebClient webClient) | |
14 { | |
15 _webClient = webClient; | |
16 } | |
17 | |
18 public string DownloadString(string address) | |
19 { | |
20 return _webClient.DownloadString(address).ToString(); | |
21 } | |
22 | |
23 public void Dispose() | |
24 { | |
25 _webClient.Dispose(); | |
26 } | |
27 } | |
28 } |