Mercurial > pub > ImplabNet
comparison Implab.Test/AsyncTests.cs @ 73:3b8393be3441 v2
fixed tests
author | cin |
---|---|
date | Fri, 05 Sep 2014 00:27:14 +0400 |
parents | dabf79fde388 |
children | c761fc982e1d |
comparison
equal
deleted
inserted
replaced
72:d67b95eddaf4 | 73:3b8393be3441 |
---|---|
21 public void RejectTest() { | 21 public void RejectTest() { |
22 int res = -1; | 22 int res = -1; |
23 Exception err = null; | 23 Exception err = null; |
24 | 24 |
25 var p = new Promise<int>(); | 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 p.Reject(new ApplicationException("error")); | 33 p.Reject(new ApplicationException("error")); |
28 | 34 |
29 Assert.AreEqual(res, -1); | 35 Assert.AreEqual(res, -1); |
30 Assert.AreEqual(err.Message, "error"); | 36 Assert.AreEqual(err.Message, "error"); |
31 | 37 |
352 } | 358 } |
353 | 359 |
354 [TestMethod] | 360 [TestMethod] |
355 public void ChainedCancel2Test() { | 361 public void ChainedCancel2Test() { |
356 // при отмене цепочки обещаний, вложенные операции также должны отменяться | 362 // при отмене цепочки обещаний, вложенные операции также должны отменяться |
357 IPromiseBase p = null; | 363 IPromise p = null; |
358 var pSurvive = new Promise<bool>(); | 364 var pSurvive = new Promise<bool>(); |
359 var hemStarted = new ManualResetEvent(false); | 365 var hemStarted = new ManualResetEvent(false); |
360 p = PromiseHelper | 366 p = PromiseHelper |
361 .Sleep(1, "Hi, HAL!") | 367 .Sleep(1, "Hi, HAL!") |
362 .Chain(x => { | 368 .Chain(x => { |