public void TestDisposeEndsPooledSessions() { var driver = new PooledQldbDriver("ledgerName", mockClient.Object, 4, 4, 4, NullLogger.Instance); var session = driver.GetSession(); session.Dispose(); driver.Dispose(); driver.Dispose(); // Once to start session, and once to end session in pool upon disposal of driver. mockClient.Verify(x => x.SendCommandAsync(It.IsAny <SendCommandRequest>(), It.IsAny <CancellationToken>()), Times.Exactly(2)); }
public void TestExecuteWithFuncLambdaAndRetryActionReturnsFuncOutput() { var driver = new PooledQldbDriver("ledgerName", mockClient.Object, 4, 1, 10, NullLogger.Instance); driver.Dispose(); Assert.ThrowsException <ObjectDisposedException>(() => driver.Execute((txn) => { txn.Execute("testStatement"); return("testReturnValue"); }, (int k) => { return; })); }