public void ConcurrentMonadArrayErrorTest() { var mc = Monad.WhenAll( 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.IsNull(mc.Result); Assert.AreEqual(mc.Error.Message, "error"); }
public void ConcurrentMonadArrayTest() { var mc = Monad.WhenAll( 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], 3); Assert.AreEqual(mc.Result[1], 4); Assert.AreEqual(mc.Result[2], 2); Assert.AreEqual(mc.Result[3], 1); Assert.IsNull(mc.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); }