Пример #1
0
        public async Task ExecuteShouldDisposeConnection()
        {
            var connection       = NewOpenConnection();
            var connectionHelper = new DefaultConnectionHelper(() => connection.Object);
            await connectionHelper.ExecuteAsync(dbConnection => Task.CompletedTask);

            connection.Verify(x => x.Dispose(), Times.Once);
        }
Пример #2
0
        public async Task ExecuteWithResultShouldDisposeConnection()
        {
            var connection       = NewOpenConnection();
            var connectionHelper = new DefaultConnectionHelper(() => connection.Object);
            await connectionHelper.ExecuteAsync <int>(dbConnection => Task.FromResult(0));

            connection.Verify(x => x.Dispose(), Times.Once);
        }
Пример #3
0
 public async Task ExecuteWithReturnShouldThrowWhenActionIsNull()
 {
     var connectionHelper = new DefaultConnectionHelper(() => null);
     await Assert.ThrowsExceptionAsync <ArgumentNullException>(() => connectionHelper.ExecuteAsync <int>(null));
 }