comparison Implab.Test/AsyncTests.cs @ 205:8200ab154c8a v2

Added ResetState to RunnableComponent to reset in case of failure Added StateChanged event to IRunnable Renamed Promise.SUCCESS -> Promise.Success Added Promise.FromException Renamed Bundle -> PromiseAll in PromiseExtensions
author cin
date Tue, 25 Oct 2016 17:40:33 +0300
parents ec91a6dfa5b3
children d6fe09f5592c
comparison
equal deleted inserted replaced
203:4d9830a9bbb8 205:8200ab154c8a
334 res2 += temp; 334 res2 += temp;
335 } 335 }
336 Console.WriteLine("done reader #2: {0} ms", Environment.TickCount - t1); 336 Console.WriteLine("done reader #2: {0} ms", Environment.TickCount - t1);
337 } 337 }
338 ) 338 )
339 .Bundle() 339 .PromiseAll()
340 .Join(); 340 .Join();
341 341
342 Assert.AreEqual(count * 3, res1 + res2); 342 Assert.AreEqual(count * 3, res1 + res2);
343 343
344 Console.WriteLine( 344 Console.WriteLine(
412 } 412 }
413 413
414 Console.WriteLine("done reader #2: {0} ms", Environment.TickCount - t1); 414 Console.WriteLine("done reader #2: {0} ms", Environment.TickCount - t1);
415 } 415 }
416 ) 416 )
417 .Bundle() 417 .PromiseAll()
418 .Join(); 418 .Join();
419 419
420 Assert.AreEqual(summ , r1 + r2); 420 Assert.AreEqual(summ , r1 + r2);
421 421
422 Console.WriteLine( 422 Console.WriteLine(
488 } 488 }
489 489
490 Console.WriteLine("done reader #2: {0} ms, avg chunk size: {1}", Environment.TickCount - t1, avgchunk); 490 Console.WriteLine("done reader #2: {0} ms, avg chunk size: {1}", Environment.TickCount - t1, avgchunk);
491 } 491 }
492 ) 492 )
493 .Bundle() 493 .PromiseAll()
494 .Join(); 494 .Join();
495 495
496 Assert.AreEqual(summ , r1 + r2); 496 Assert.AreEqual(summ , r1 + r2);
497 497
498 Console.WriteLine( 498 Console.WriteLine(
591 count += buffer.Length; 591 count += buffer.Length;
592 } 592 }
593 Console.WriteLine("done reader #2: {0} ms, {1} items", Environment.TickCount - t1, count); 593 Console.WriteLine("done reader #2: {0} ms, {1} items", Environment.TickCount - t1, count);
594 } 594 }
595 ) 595 )
596 .Bundle() 596 .PromiseAll()
597 .Join(); 597 .Join();
598 598
599 Assert.AreEqual(summ , r1 + r2); 599 Assert.AreEqual(summ , r1 + r2);
600 600
601 Console.WriteLine( 601 Console.WriteLine(
833 } finally { 833 } finally {
834 l.Release(); 834 l.Release();
835 log.Enqueue("Writer #1 lock released"); 835 log.Enqueue("Writer #1 lock released");
836 } 836 }
837 } 837 }
838 ).Bundle().Join(1000); 838 ).PromiseAll().Join(1000);
839 log.Enqueue("Done"); 839 log.Enqueue("Done");
840 } catch(Exception error) { 840 } catch(Exception error) {
841 log.Enqueue(error.Message); 841 log.Enqueue(error.Message);
842 throw; 842 throw;
843 } finally { 843 } finally {