diff Implab.Test/AsyncTests.cs @ 23:f0568ff069a5

Слияние с promises
author cin
date Wed, 13 Nov 2013 14:03:20 +0400
parents 5a35900264f5
children ee04e1fa78da
line wrap: on
line diff
--- a/Implab.Test/AsyncTests.cs	Fri Nov 08 01:27:04 2013 +0400
+++ b/Implab.Test/AsyncTests.cs	Wed Nov 13 14:03:20 2013 +0400
@@ -14,7 +14,7 @@
             p.Then(x => res = x);
             p.Resolve(100);
 
-            Assert.AreEqual(res, 100);
+            Assert.AreEqual(100, res);
         }
 
         [TestMethod]
@@ -101,18 +101,18 @@
         public void WorkerPoolSizeTest() {
             var pool = new WorkerPool(5, 10, 0);
 
-            Assert.AreEqual(5, pool.ThreadCount);
+            Assert.AreEqual(5, pool.PoolSize);
 
-            pool.Invoke(() => { Thread.Sleep(1000000); return 10; });
-            pool.Invoke(() => { Thread.Sleep(1000000); return 10; });
-            pool.Invoke(() => { Thread.Sleep(1000000); return 10; });
+            pool.Invoke(() => { Thread.Sleep(100000000); return 10; });
+            pool.Invoke(() => { Thread.Sleep(100000000); return 10; });
+            pool.Invoke(() => { Thread.Sleep(100000000); return 10; });
 
-            Assert.AreEqual(5, pool.ThreadCount);
+            Assert.AreEqual(5, pool.PoolSize);
 
             for (int i = 0; i < 100; i++)
-                pool.Invoke(() => { Thread.Sleep(1000000); return 10; });
-            Thread.Sleep(100);
-            Assert.AreEqual(10, pool.ThreadCount);
+                pool.Invoke(() => { Thread.Sleep(100000000); return 10; });
+            Thread.Sleep(200);
+            Assert.AreEqual(10, pool.PoolSize);
 
             pool.Dispose();
         }
@@ -149,10 +149,10 @@
         [TestMethod]
         public void WorkerPoolDisposeTest() {
             var pool = new WorkerPool(5, 20);
-            Assert.AreEqual(5, pool.ThreadCount);
+            Assert.AreEqual(5, pool.PoolSize);
             pool.Dispose();
-            Thread.Sleep(100);
-            Assert.AreEqual(0, pool.ThreadCount);
+            Thread.Sleep(500);
+            Assert.AreEqual(0, pool.PoolSize);
             pool.Dispose();
         }
 
@@ -244,7 +244,7 @@
         [TestMethod]
         public void ChainedMapTest() {
 
-            using (var pool = new WorkerPool(8,100,0)) {
+            using (var pool = new WorkerPool(4,4,0)) {
                 int count = 10000;
 
                 double[] args = new double[count];