Esempio n. 1
0
        private void Execute_doesnt_retry(Action <IDbExecutionStrategy, Func <int> > execute)
        {
            var executionStrategy = new DefaultExecutionStrategy();
            var executionCount    = 0;

            Assert.Throws <TimeoutException>(
                () =>
                execute(executionStrategy,
                        () =>
            {
                executionCount++;
                throw new TimeoutException();
            }));

            Assert.Equal(1, executionCount);
        }
Esempio n. 2
0
        private void ExecuteAsync_doesnt_retry(Func <IDbExecutionStrategy, Func <Task <int> >, Task> executeAsync)
        {
            var executionStrategy = new DefaultExecutionStrategy();
            var executionCount    = 0;

            Assert.Throws <TimeoutException>(
                () =>
                ExceptionHelpers.UnwrapAggregateExceptions(
                    () =>
                    executeAsync(executionStrategy,
                                 () =>
            {
                executionCount++;
                throw new TimeoutException();
            }).Wait()));

            Assert.Equal(1, executionCount);
        }