Example #1
0
        public void ThrowsRightExceptionBeforeTimeout()
        {
            var t1 = TestTasks.GetResult(TimeSpan.FromSeconds(2), 1);

            Assert.ThrowsAsync <ArgumentException>(async() =>
                                                   await t1.WithTimeout(TimeSpan.FromSeconds(1)));
        }
Example #2
0
        public void ThrowsTimeoutExceptionBeforeArgument()
        {
            var t1 = TestTasks.GetResult(TimeSpan.FromSeconds(5), 2);

            Assert.ThrowsAsync <TaskCanceledException>(async() =>
                                                       await t1.WithTimeout(TimeSpan.FromSeconds(2)));
        }
Example #3
0
        public void NotThrowsBeforeTimeout()
        {
            var t1 = TestTasks.GetResult(TimeSpan.FromSeconds(2), 0);

            Assert.DoesNotThrowAsync(async() =>
                                     await t1.WithTimeout(TimeSpan.FromSeconds(5)));
        }