Exemplo n.º 1
0
        public static IDisposable CreateTransactionScope(bool useTransaction)
        {
#if NET461
            return(TestStore.CreateTransactionScope(useTransaction));
#else
            return(TestStore.CreateTransactionScope(useTransaction: false));
#endif
        }
Exemplo n.º 2
0
        private async Task ExecuteAsync_throws_for_an_ambient_transaction(Func <ExecutionStrategy, Task> executeAsync)
        {
            var mockExecutionStrategy = new TestExecutionStrategy(Context);

            using (TestStore.CreateTransactionScope())
            {
                Assert.Equal(
                    CoreStrings.ExecutionStrategyExistingTransaction(
                        mockExecutionStrategy.GetType().Name, "DbContext.Database.CreateExecutionStrategy()"),
                    (await Assert.ThrowsAsync <InvalidOperationException>(
                         () => executeAsync(mockExecutionStrategy)))
                    .Message);
            }
        }
Exemplo n.º 3
0
        private void Execute_throws_for_an_ambient_transaction(Action <ExecutionStrategy> execute)
        {
            var mockExecutionStrategy = new TestExecutionStrategy(Context);

            using (TestStore.CreateTransactionScope())
            {
                Assert.Equal(
                    CoreStrings.ExecutionStrategyExistingTransaction(
                        mockExecutionStrategy.GetType().Name, "DbContext.Database.CreateExecutionStrategy()"),
                    Assert.Throws <InvalidOperationException>(
                        () => execute(mockExecutionStrategy))
                    .Message);
            }
        }
Exemplo n.º 4
0
 protected static IDisposable CreateTransactionScope(bool useTransaction)
 => TestStore.CreateTransactionScope(useTransaction);
 public static IDisposable CreateTransactionScope(bool useTransaction)
 {
     return(TestStore.CreateTransactionScope(useTransaction));
 }
 public static IDisposable CreateTransactionScope(bool useTransaction)
 => TestStore.CreateTransactionScope(useTransaction: false);