diff Implab.Test/AsyncTests.cs @ 138:f75cfa58e3d4 v2

added ICancellable.Cancel(Exception) to allow specify the reason of cancellation
author cin
date Tue, 17 Feb 2015 18:16:26 +0300
parents e9e7940c7d98
children 706fccb85524
line wrap: on
line diff
--- a/Implab.Test/AsyncTests.cs	Mon Feb 16 17:48:39 2015 +0300
+++ b/Implab.Test/AsyncTests.cs	Tue Feb 17 18:16:26 2015 +0300
@@ -53,7 +53,7 @@
             var p = new Promise<bool>();
             p.Cancel();
 
-            var p2 = p.Cancelled(() => {
+            var p2 = p.Then(x => x, null, reason => {
                 throw new ApplicationException("CANCELLED"); 
             });
 
@@ -72,10 +72,10 @@
             p.Cancel();
 
             var p2 = p
-                .Cancelled<bool>(() => {
+                .Then<bool>(x => x, null, reason => {
                     throw new ApplicationException("CANCELLED");
                 })
-                .Error(e => true);
+                .Then(x => x, e => true);
 
             Assert.AreEqual(true, p2.Join());
         }
@@ -116,7 +116,7 @@
         public void FixErrorTest() {
             var p = new Promise<int>();
 
-            var p2 = p.Error(e => 101);
+            var p2 = p.Then(x => x, e => 101);
 
             p.Reject(new Exception());
 
@@ -760,7 +760,7 @@
                         });
 
                     result
-                        .Cancelled(() => pSurvive.Resolve(true));
+                        .On(() => pSurvive.Resolve(true), PromiseEventType.Cancelled);
                     
                     return result;
                 });