@@ -23,7 +23,13 namespace Implab.Test { | |||
|
23 | 23 | Exception err = null; |
|
24 | 24 | |
|
25 | 25 | var p = new Promise<int>(); |
|
26 | p.Then(x => res = x, e => err = e); | |
|
26 | p.Then( | |
|
27 | x => res = x, | |
|
28 | e => { | |
|
29 | err = e; | |
|
30 | return -2; | |
|
31 | } | |
|
32 | ); | |
|
27 | 33 | p.Reject(new ApplicationException("error")); |
|
28 | 34 | |
|
29 | 35 | Assert.AreEqual(res, -1); |
@@ -354,7 +360,7 namespace Implab.Test { | |||
|
354 | 360 | [TestMethod] |
|
355 | 361 | public void ChainedCancel2Test() { |
|
356 | 362 | // при отмене цепочки обещаний, вложенные операции также должны отменяться |
|
357 |
IPromise |
|
|
363 | IPromise p = null; | |
|
358 | 364 | var pSurvive = new Promise<bool>(); |
|
359 | 365 | var hemStarted = new ManualResetEvent(false); |
|
360 | 366 | p = PromiseHelper |
@@ -7,7 +7,7 using System.Threading; | |||
|
7 | 7 | |
|
8 | 8 | namespace Implab.Test { |
|
9 | 9 | class PromiseHelper { |
|
10 | public static Promise<T> Sleep<T>(int timeout, T retVal) { | |
|
10 | public static IPromise<T> Sleep<T>(int timeout, T retVal) { | |
|
11 | 11 | return AsyncPool.Invoke(() => { |
|
12 | 12 | Thread.Sleep(timeout); |
|
13 | 13 | return retVal; |
General Comments 0
You need to be logged in to leave comments.
Login now