comparison Implab.Test/PollingComponentTests.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
comparison
equal deleted inserted replaced
203:4d9830a9bbb8 205:8200ab154c8a
34 public void NormalFlowTest() { 34 public void NormalFlowTest() {
35 var comp = new MockPollingComponent(TimeSpan.FromMilliseconds(1), null, false); 35 var comp = new MockPollingComponent(TimeSpan.FromMilliseconds(1), null, false);
36 36
37 Assert.AreEqual(ExecutionState.Created, comp.State); 37 Assert.AreEqual(ExecutionState.Created, comp.State);
38 38
39 comp.Init(); 39 comp.Initialize();
40 40
41 Assert.AreEqual(ExecutionState.Ready, comp.State); 41 Assert.AreEqual(ExecutionState.Ready, comp.State);
42 42
43 comp.Start().Join(1000); 43 comp.Start().Join(1000);
44 44
55 var signal = new Signal(); 55 var signal = new Signal();
56 56
57 var comp = new MockPollingComponent(TimeSpan.FromMilliseconds(1), null, true); 57 var comp = new MockPollingComponent(TimeSpan.FromMilliseconds(1), null, true);
58 comp.MockTick = ct => { 58 comp.MockTick = ct => {
59 signal.Set(); 59 signal.Set();
60 return Promise.SUCCESS; 60 return Promise.Success;
61 }; 61 };
62 62
63 comp.Start().Join(1000); 63 comp.Start().Join(1000);
64 signal.Wait(1000); 64 signal.Wait(1000);
65 comp.Stop().Join(1000); 65 comp.Stop().Join(1000);