comparison Implab.Test/AsyncTests.cs @ 11:6ec82bf68c8e promises

refactoring
author cin
date Tue, 05 Nov 2013 01:09:58 +0400
parents aa33d0bb8c0c
children b0feb5b9ad1c
comparison
equal deleted inserted replaced
10:aa33d0bb8c0c 11:6ec82bf68c8e
1 using System; 1 using System;
2 using Microsoft.VisualStudio.TestTools.UnitTesting; 2 using Microsoft.VisualStudio.TestTools.UnitTesting;
3 using System.Reflection; 3 using System.Reflection;
4 using System.Threading; 4 using System.Threading;
5 using Implab.Parallels;
5 6
6 namespace Implab.Test 7 namespace Implab.Test
7 { 8 {
8 [TestClass] 9 [TestClass]
9 public class AsyncTests 10 public class AsyncTests
68 69
69 Assert.AreEqual (p2.Join (), "100"); 70 Assert.AreEqual (p2.Join (), "100");
70 } 71 }
71 72
72 [TestMethod] 73 [TestMethod]
74 public void FixErrorTest() {
75 var p = new Promise<int>();
76
77 var p2 = p.Error(e => 101);
78
79 p.Reject(new Exception());
80
81 Assert.AreEqual(p2.Join(), 101);
82 }
83
84 [TestMethod]
73 public void ChainTest () 85 public void ChainTest ()
74 { 86 {
75 var p1 = new Promise<int> (); 87 var p1 = new Promise<int> ();
76 88
77 var p3 = p1.Chain (x => { 89 var p3 = p1.Chain (x => {