@@ -139,6 +139,21 namespace Implab.Test { | |||||
139 | } |
|
139 | } | |
140 |
|
140 | |||
141 | [TestMethod] |
|
141 | [TestMethod] | |
|
142 | public void ChainFailTest() { | |||
|
143 | var p1 = new Promise<int>(); | |||
|
144 | ||||
|
145 | var p3 = p1.Chain(x => { | |||
|
146 | var p2 = new Promise<string>(); | |||
|
147 | p2.Reject(new Exception("DIE!!!")); | |||
|
148 | return p2; | |||
|
149 | }); | |||
|
150 | ||||
|
151 | p1.Resolve(100); | |||
|
152 | ||||
|
153 | Assert.IsTrue(p3.IsResolved); | |||
|
154 | } | |||
|
155 | ||||
|
156 | [TestMethod] | |||
142 | public void PoolTest() { |
|
157 | public void PoolTest() { | |
143 | var pid = Thread.CurrentThread.ManagedThreadId; |
|
158 | var pid = Thread.CurrentThread.ManagedThreadId; | |
144 | var p = AsyncPool.Invoke(() => Thread.CurrentThread.ManagedThreadId); |
|
159 | var p = AsyncPool.Invoke(() => Thread.CurrentThread.ManagedThreadId); |
@@ -893,7 +893,7 namespace Implab { | |||||
893 |
|
893 | |||
894 |
|
894 | |||
895 | void IPromise.On(Action success, Action<Exception> error, Action cancel) { |
|
895 | void IPromise.On(Action success, Action<Exception> error, Action cancel) { | |
896 | On(x => success(), error, cancel); |
|
896 | On(success != null ? new Action<T>(x => success()) : null, error, cancel); | |
897 | } |
|
897 | } | |
898 |
|
898 | |||
899 | void IPromise.On(Action success, Action<Exception> error) { |
|
899 | void IPromise.On(Action success, Action<Exception> error) { |
General Comments 0
You need to be logged in to leave comments.
Login now