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); } }
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); } }