Commit 3cfb03d

mokhan <mokhan@ce5e1baf-6525-42e4-a1b2-857ea38da20a>
2009-03-04 15:50:42
updated dependency from worker_thread to IWorkerThread.
git-svn-id: https://svn.xp-dev.com/svn/mokhan-mo.money@39 ce5e1baf-6525-42e4-a1b2-857ea38da20a
1 parent 9cafdd9
Changed files (2)
trunk
product
trunk/product/MyMoney/Infrastructure/Threading/background_thread.cs
@@ -3,20 +3,21 @@ using MyMoney.Utility.Core;
 namespace MyMoney.Infrastructure.Threading
 {
     public interface IBackgroundThread : IDisposableCommand
-    {}
+    {
+    }
 
     public class background_thread : IBackgroundThread
     {
-        private readonly worker_thread worker_thread;
+        readonly IWorkerThread worker_thread;
 
         public background_thread(IDisposableCommand command_to_execute)
             : this(command_to_execute, new worker_thread())
-        {}
+        {
+        }
 
-        public background_thread(IDisposableCommand command_to_execute, worker_thread worker_thread)
+        public background_thread(IDisposableCommand command_to_execute, IWorkerThread worker_thread)
         {
             this.worker_thread = worker_thread;
-
             worker_thread.DoWork += ((sender, e) => command_to_execute.run());
             worker_thread.Disposed += ((sender, e) => command_to_execute.Dispose());
         }
@@ -28,7 +29,6 @@ namespace MyMoney.Infrastructure.Threading
 
         public void run()
         {
-            //worker_thread.RunWorkerAsync();
             worker_thread.Begin();
         }
     }
trunk/product/MyMoney/Infrastructure/Threading/background_thread_specs.cs
@@ -10,19 +10,14 @@ namespace MyMoney.Infrastructure.Threading
     [Concern(typeof (background_thread))]
     public abstract class behaves_like_a_background_thread : concerns_for<IBackgroundThread, background_thread>
     {
-        public override IBackgroundThread create_sut()
-        {
-            return new background_thread(command_to_execute, worker_thread);
-        }
-
         context c = () =>
                         {
                             command_to_execute = the_dependency<IDisposableCommand>();
-                            worker_thread = dependency<worker_thread>();
+                            worker_thread = the_dependency<IWorkerThread>();
                         };
 
         protected static IDisposableCommand command_to_execute;
-        protected static worker_thread worker_thread;
+        protected static IWorkerThread worker_thread;
     }
 
     public class when_executing_a_command_on_a_background_thread : behaves_like_a_background_thread