Esempio n. 1
0
        public void AsncTimeoutExtensionTest()
        {
            var timeout      = TimeSpan.FromSeconds(5);
            var taskExecTime = TimeSpan.FromSeconds(10);

            long measureTime = 0;

            PerformanceHelper.StartMeasure(ref measureTime);

            Assert.Catch <TimeoutException>(async() => await CreateDelayTask(taskExecTime).TimeoutAfter(timeout));
            var timeRequired = PerformanceHelper.StopMeasure(measureTime);
        }
Esempio n. 2
0
        public void AsncNoTimeoutExtensionTest()
        {
            var timeout      = TimeSpan.FromSeconds(10);
            var taskExecTime = TimeSpan.FromSeconds(2);

            long measureTime = 0;

            PerformanceHelper.StartMeasure(ref measureTime);
            var t = CreateDelayTask(taskExecTime);

            Assert.DoesNotThrow(async() => await t.TimeoutAfter(timeout));
            var timeRequired = PerformanceHelper.StopMeasure(measureTime);
        }