Exemplo n.º 1
0
        public void WaitAsync_Disposed_ReturnsFaultedTask()
        {
            var era = new Era();

            era.Dispose();

            TaskAssert.Faulted <ObjectDisposedException>(era.WaitAsync());
        }
Exemplo n.º 2
0
        public void Dispose_FaultsAwaiters()
        {
            var era = new Era();

            var awaiter = era.WaitAsync();

            era.Dispose();

            TaskAssert.Faulted <ObjectDisposedException>(awaiter);
        }
Exemplo n.º 3
0
        public void WaitAsync_NotEnded_WaitsForEnd()
        {
            using (var era = new Era())
            {
                var awaiter = era.WaitAsync();

                TaskAssert.DoesNotEnd(awaiter);
                era.End();
                TaskAssert.Completed(awaiter);
            }
        }
Exemplo n.º 4
0
        public void WaitAsync_NotEnded_Cancelable()
        {
            using (var cts = new CancellationTokenSource())
                using (var era = new Era())
                {
                    var awaiter = era.WaitAsync(cts.Token);

                    TaskAssert.DoesNotEnd(awaiter);
                    cts.Cancel();
                    TaskAssert.Cancelled(awaiter);
                }
        }
Exemplo n.º 5
0
 /// <inheritdoc />
 public Task WaitAsync(CancellationToken ACancel) => FCurrent.WaitAsync(ACancel);