public async Task Throws_on_BeginTransactionAsync() { var optionsBuilder = new DbContextOptionsBuilder(); optionsBuilder.UseInMemoryDatabase(); var transactionManager = new InMemoryTransactionManager(optionsBuilder.Options); Assert.Equal( InMemoryStrings.TransactionsNotSupported, (await Assert.ThrowsAsync <InvalidOperationException>( async() => await transactionManager.BeginTransactionAsync())).Message); }
public async Task Does_not_throw_on_BeginTransactionAsync_when_transactions_ignored() { var optionsBuilder = new DbContextOptionsBuilder() .UseInMemoryDatabase(b => b.IgnoreTransactions()); var transactionManager = new InMemoryTransactionManager(optionsBuilder.Options); using (var transaction = await transactionManager.BeginTransactionAsync()) { transaction.Commit(); transaction.Rollback(); } }
public async Task Throws_on_BeginTransactionAsync() { var optionsBuilder = new DbContextOptionsBuilder(); optionsBuilder.UseInMemoryDatabase(Guid.NewGuid().ToString()); var transactionManager = new InMemoryTransactionManager(new FakeLogger()); Assert.Equal( InMemoryStrings.LogTransactionsNotSupported.GenerateMessage(), (await Assert.ThrowsAsync <InvalidOperationException>( async() => await transactionManager.BeginTransactionAsync())).Message); }