public async Task StartTransactionAsync_should_return_NullTransaction() { var sut = new CosmosTransactionManager(); var result = await sut.StartTransactionAsync(); result.Should().BeOfType <NullTransaction>(); }
public virtual async Task CosmosTransactionManager_does_not_support_transactions() { var transactionManager = new CosmosTransactionManager(); Assert.Equal( CosmosStrings.TransactionsNotSupported, Assert.Throws <NotSupportedException>(() => transactionManager.BeginTransaction()).Message); Assert.Equal( CosmosStrings.TransactionsNotSupported, (await Assert.ThrowsAsync <NotSupportedException>(async() => await transactionManager.BeginTransactionAsync())).Message); Assert.Equal( CosmosStrings.TransactionsNotSupported, Assert.Throws <NotSupportedException>(() => transactionManager.CommitTransaction()).Message); Assert.Equal( CosmosStrings.TransactionsNotSupported, (await Assert.ThrowsAsync <NotSupportedException>(async() => await transactionManager.CommitTransactionAsync())).Message); Assert.Equal( CosmosStrings.TransactionsNotSupported, Assert.Throws <NotSupportedException>(() => transactionManager.RollbackTransaction()).Message); Assert.Equal( CosmosStrings.TransactionsNotSupported, (await Assert.ThrowsAsync <NotSupportedException>(async() => await transactionManager.RollbackTransactionAsync())).Message); Assert.Null(transactionManager.CurrentTransaction); Assert.Null(transactionManager.EnlistedTransaction); Assert.Equal( CosmosStrings.TransactionsNotSupported, Assert.Throws <NotSupportedException>(() => transactionManager.EnlistTransaction(null)).Message); transactionManager.ResetState(); await transactionManager.ResetStateAsync(); Assert.Null(transactionManager.CurrentTransaction); Assert.Null(transactionManager.EnlistedTransaction); }