# HG changeset patch
# User stevenh7776 stevenhollidge@hotmail.com
# Date 1329818747 -25200
# Node ID 6e84a4c923783eff174e62e8855b69e346c181ac
# Parent cdc88fd7cb89a5d19d4fae40c5d9377b99414db0
FakeWebClientShim added and refactoring
diff -r cdc88fd7cb89 -r 6e84a4c92378 .hgignore
--- a/.hgignore Tue Feb 21 01:19:54 2012 +0700
+++ b/.hgignore Tue Feb 21 17:05:47 2012 +0700
@@ -4,3 +4,4 @@
*.suo
*.csproj.user
*/obj/*
+Stocks/packages/xunit.extensions.1.9.0.1566/xunit.extensions.1.9.0.1566.nupkg
diff -r cdc88fd7cb89 -r 6e84a4c92378 Stocks/Stocks.Common/EventArgs/PriceChangedEventArgs.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Stocks/Stocks.Common/EventArgs/PriceChangedEventArgs.cs Tue Feb 21 17:05:47 2012 +0700
@@ -0,0 +1,9 @@
+using Stocks.Common.Models;
+
+namespace Stocks.Common.Events
+{
+ public class PriceChangedEventArgs
+ {
+ public Price Price { get; set; }
+ }
+}
diff -r cdc88fd7cb89 -r 6e84a4c92378 Stocks/Stocks.Common/Events/PriceChanged.cs
--- a/Stocks/Stocks.Common/Events/PriceChanged.cs Tue Feb 21 01:19:54 2012 +0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-using Stocks.Common.Models;
-
-namespace Stocks.Common.Events
-{
- public class PriceChangedEventArgs
- {
- public Price Price { get; set; }
- }
-}
diff -r cdc88fd7cb89 -r 6e84a4c92378 Stocks/Stocks.Common/Fakes/FakeWebClientShim.cs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Stocks/Stocks.Common/Fakes/FakeWebClientShim.cs Tue Feb 21 17:05:47 2012 +0700
@@ -0,0 +1,23 @@
+
+namespace Stocks.Common.Fakes
+{
+ public class FakeWebClientShim : IWebClientShim
+ {
+ private string _downloadString;
+
+ public FakeWebClientShim(string downloadString = "")
+ {
+ _downloadString = downloadString;
+ }
+
+ public string DownloadString(string address)
+ {
+ return _downloadString;
+ }
+
+ public void Dispose()
+ {
+ // do nothing
+ }
+ }
+}
diff -r cdc88fd7cb89 -r 6e84a4c92378 Stocks/Stocks.Common/Stocks.Common.csproj
--- a/Stocks/Stocks.Common/Stocks.Common.csproj Tue Feb 21 01:19:54 2012 +0700
+++ b/Stocks/Stocks.Common/Stocks.Common.csproj Tue Feb 21 17:05:47 2012 +0700
@@ -53,8 +53,9 @@
-
+
+
diff -r cdc88fd7cb89 -r 6e84a4c92378 Stocks/Stocks.Common/WebClientShim.cs
--- a/Stocks/Stocks.Common/WebClientShim.cs Tue Feb 21 01:19:54 2012 +0700
+++ b/Stocks/Stocks.Common/WebClientShim.cs Tue Feb 21 17:05:47 2012 +0700
@@ -15,8 +15,6 @@
_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();
diff -r cdc88fd7cb89 -r 6e84a4c92378 Stocks/Stocks.Service/StocksService.cs
--- a/Stocks/Stocks.Service/StocksService.cs Tue Feb 21 01:19:54 2012 +0700
+++ b/Stocks/Stocks.Service/StocksService.cs Tue Feb 21 17:05:47 2012 +0700
@@ -46,9 +46,9 @@
_serviceUrl = _configurationService.GetServiceUrl(symbolsCsv);
}
+ public event PriceChangedEventHandler PriceChanged;
public delegate void PriceChangedEventHandler(object sender, PriceChangedEventArgs e);
- public event PriceChangedEventHandler PriceChanged;
- protected virtual void RaisePriceChanged(Price price)
+ protected virtual void OnPriceChanged(Price price)
{
Stats.PriceChangeEvents++;
@@ -128,7 +128,7 @@
{
localPrice.PreviousPrice = localPrice.CurrentPrice;
localPrice.CurrentPrice = webPrice.CurrentPrice;
- RaisePriceChanged(localPrice);
+ OnPriceChanged(localPrice);
}
private void UpdateStats(Stopwatch timeToDownload, string webResponse)