diff Implab.Test/Mock/MockRunnableComponent.cs @ 205:8200ab154c8a v2

Added ResetState to RunnableComponent to reset in case of failure Added StateChanged event to IRunnable Renamed Promise.SUCCESS -> Promise.Success Added Promise.FromException Renamed Bundle -> PromiseAll in PromiseExtensions
author cin
date Tue, 25 Oct 2016 17:40:33 +0300
parents 4d9830a9bbb8
children 7d07503621fe
line wrap: on
line diff
--- a/Implab.Test/Mock/MockRunnableComponent.cs	Tue Oct 18 17:49:54 2016 +0300
+++ b/Implab.Test/Mock/MockRunnableComponent.cs	Tue Oct 25 17:40:33 2016 +0300
@@ -6,6 +6,9 @@
         public MockRunnableComponent(bool initialized) : base(initialized) {
         }
 
+        public MockRunnableComponent(bool initialized, bool reusable) : base(initialized, reusable) {
+        }
+
         public Action MockInit {
             get;
             set;
@@ -21,6 +24,11 @@
             set;
         }
 
+        public Action<bool, Exception> MockDispose {
+            get;
+            set;
+        }
+
         protected override IPromise OnStart() {
             return MockStart != null ? Safe.Run(MockStart).Chain(base.OnStart) : Safe.Run(base.OnStart);
         }
@@ -33,6 +41,12 @@
             if (MockInit != null)
                 MockInit();
         }
+
+        protected override void Dispose(bool disposing, Exception lastError) {
+            if (MockDispose != null)
+                MockDispose(disposing, lastError);
+            base.Dispose(disposing, lastError);
+        }
     }
 }