Exemple #1
0
        private async Task ExecuteAsync_throws_for_an_existing_transaction(Func <ExecutionStrategy, Task> executeAsync)
        {
            var mockExecutionStrategy = new TestExecutionStrategy(Context);

            using (Context.Database.BeginTransaction())
            {
                Assert.Equal(
                    CoreStrings.ExecutionStrategyExistingTransaction(mockExecutionStrategy.GetType().Name, "DbContext.Database.CreateExecutionStrategy()"),
                    (await Assert.ThrowsAsync <InvalidOperationException>(
                         () => executeAsync(mockExecutionStrategy))).Message);
            }
        }
Exemple #2
0
        private void Execute_throws_for_an_existing_transaction(Action <ExecutionStrategy> execute)
        {
            var mockExecutionStrategy = new TestExecutionStrategy(Context);

            using (Context.Database.BeginTransaction())
            {
                Assert.Equal(
                    CoreStrings.ExecutionStrategyExistingTransaction(mockExecutionStrategy.GetType().Name, "DbContext.Database.CreateExecutionStrategy()"),
                    Assert.Throws <InvalidOperationException>(
                        () => execute(mockExecutionStrategy))
                    .Message);
            }
        }