public void BeginTransaction_WithRetry() { var retryOptions = new RetryOptions(10, TimeSpan.FromSeconds(60)); ITransactionFactory transactionFactory = new SqliteTransactionFactoryWithRetry(retryOptions); IConnectionFactory connectionFactory = new SqliteConnectionFactoryWithRetry(retryOptions); using (var connection = connectionFactory.Open(_connectionString)) using (var transaction = transactionFactory.BeginTransaction(connection)) { Assert.IsNotNull(transaction); Assert.AreEqual(connection, transaction.Connection); Assert.AreEqual(IsolationLevel.Serializable, transaction.IsolationLevel); transaction.Rollback(); } }
public void BeginTransaction_WithIsolationLevel_WithRetry_Fail() { // sqlite only supports IsolationLevel.Serializable var retryPolicy = new SqliteTransientRetryPolicy(10, TimeSpan.FromSeconds(60)); ITransactionFactory transactionFactory = new SqliteTransactionFactoryWithRetry(retryPolicy); IConnectionFactory connectionFactory = new SqliteConnectionFactoryWithRetry(retryPolicy); using (var connection = connectionFactory.Open(_connectionString)) using (var transaction = transactionFactory.BeginTransaction(connection, IsolationLevel.Snapshot)) { Assert.IsNotNull(transaction); Assert.AreEqual(connection, transaction.Connection); Assert.AreEqual(IsolationLevel.Snapshot, transaction.IsolationLevel); transaction.Rollback(); } }