public void Can_get_current_transaction()
        {
            var transaction = new FakeDbContextTransaction();

            var context = InMemoryTestHelpers.Instance.CreateContext(
                new ServiceCollection().AddSingleton <IDbContextTransactionManager>(
                    new FakeDbContextTransactionManager(transaction)));

            Assert.Same(transaction, context.Database.CurrentTransaction);
        }
        public async Task Can_begin_transaction(bool async)
        {
            var transaction = new FakeDbContextTransaction();

            var context = InMemoryTestHelpers.Instance.CreateContext(
                new ServiceCollection().AddSingleton <IDbContextTransactionManager>(
                    new FakeDbContextTransactionManager(transaction)));

            Assert.Same(
                transaction,
                async
                    ? await context.Database.BeginTransactionAsync()
                    : context.Database.BeginTransaction());
        }
 public FakeDbContextTransactionManager(FakeDbContextTransaction transaction)
 {
     _transaction = transaction;
 }