public void WaitAllConcurrentMonadArrayErrorTest() { var mc = Monad.WaitAll( new BlockMonad <int>(r => TestTask5(3, 3, r)), new BlockMonad <int>(r => TestTask5(4, 5, r)), new BlockMonad <int>(r => TestTask5(2, 1, r)), new BlockMonad <int>(r => TestTask5(1, 3, r)), new BlockMonad <int>(r => TestTask6("error", 3, r)) ); _Wait(mc); Assert.AreEqual(mc.Result[0].Result, 3); Assert.AreEqual(mc.Result[1].Result, 4); Assert.AreEqual(mc.Result[2].Result, 2); Assert.AreEqual(mc.Result[3].Result, 1); for (int i = 0; i < 4; i++) { var r = mc.Result[i]; Assert.IsNull(r.Error); } Assert.IsNull(mc.Error); Assert.AreEqual(mc.Result[4].Error.Message, "error"); }
public void WaitAllConcurrentMonadArrayTest() { var mc = Monad.WaitAll( new BlockMonad <int>(r => TestTask5(3, 3, r)), new BlockMonad <int>(r => TestTask5(4, 5, r)), new BlockMonad <int>(r => TestTask5(2, 1, r)), new BlockMonad <int>(r => TestTask5(1, 3, r)) ); _Wait(mc); Assert.AreEqual(mc.Result[0].Result, 3); Assert.AreEqual(mc.Result[1].Result, 4); Assert.AreEqual(mc.Result[2].Result, 2); Assert.AreEqual(mc.Result[3].Result, 1); foreach (var r in mc.Result) { Assert.IsNull(r.Error); } Assert.IsNull(mc.Error); }