Ejemplo n.º 1
0
        public IEnumerator ContinueWithExceptionSync()
        {
            var op = new ContinueLitTaskOperation(ThrowExceptionSync());

            yield return(op);

            Assert.True(op.exception is TestException);
        }
Ejemplo n.º 2
0
        public IEnumerator ContinueWhenAll()
        {
            var startTime = System.DateTime.Now;
            var op        = new ContinueLitTaskOperation(LitTask.WhenAll(new LitTask[] {
                Delay(100),
                Delay(1000),
            }));

            yield return(op);

            Assert.Greater(DateTime.Now, startTime + TimeSpan.FromMilliseconds(1000));
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        public IEnumerator ContinueWhenAllWithException()
        {
            System.DateTime start = System.DateTime.Now;
            var             op    = new ContinueLitTaskOperation(LitTask.WhenAll(new LitTask[] {
                Delay(100),
                ThrowExceptionAfterAsync(10),
            }));

            yield return(op);

            Assert.NotNull(op.exception);
            Assert.True(op.exception is AggregateException);
            Assert.True((op.exception as AggregateException).InnerException is TestException);
            Assert.GreaterOrEqual(DateTime.Now, start + TimeSpan.FromMilliseconds(100));
        }