public IEnumerator ContinueWhenAny() { var startTime = System.DateTime.Now; var op = new ContinueLitTaskOperation <LitTask.WhenAnyResult>(LitTask.WhenAny(new LitTask[] { Delay(1000), Delay(100), })); yield return(op); Assert.GreaterOrEqual(System.DateTime.Now, startTime + System.TimeSpan.FromMilliseconds(100)); Assert.LessOrEqual(System.DateTime.Now, startTime + System.TimeSpan.FromMilliseconds(1000)); Assert.AreEqual(op.value.FirstCompletedTaskIndex, 1); }
public IEnumerator AwaitWhenAnyWithExceptionLater() { var startTime = System.DateTime.Now; var op = new AwaitLitTaskOperation <LitTask.WhenAnyResult>(LitTask.WhenAny(new LitTask[] { Delay(100), ThrowExceptionAfterAsync(1000), })); yield return(op); Assert.GreaterOrEqual(System.DateTime.Now, startTime + System.TimeSpan.FromMilliseconds(100)); Assert.LessOrEqual(System.DateTime.Now, startTime + System.TimeSpan.FromMilliseconds(1000)); Assert.AreEqual(op.value.FirstCompletedTaskIndex, 0); Assert.IsNull(op.value.Exception); }