public void ThrowsExceptionWhenAlreadyDisposedOnRollback() { var target = new DbContextTransactionAdapter(transaction.Object); target.Dispose(); Assert.ThrowsAsync <ObjectDisposedException>(async() => await target.RollbackAsync(CancellationToken.None)); }
public void MustDisposeTheTransactionWhenOwned() { using (var target = new DbContextTransactionAdapter(transaction.Object)) { Assert.True(target.OwnsTransaction); } transaction.Verify(o => o.Dispose(), Times.Once); }
public void MustNotDisposeTheTransactionWhenNotOwned() { using (var target = new DbContextTransactionAdapter(transaction.Object, false)) { Assert.False(target.OwnsTransaction); } transaction.Verify(o => o.Dispose(), Times.Never); }
public async Task MustRollbackTheTransaction() { using (var target = new DbContextTransactionAdapter(transaction.Object)) { await target.RollbackAsync(CancellationToken.None); } transaction.Verify(o => o.Rollback(), Times.Once); }