public async void GetCustomerPoliciesAsync() { _logger.LogInformation("GetCustomerPoliciesAsync..."); var newPolicy = A.New <TestPolicy>(); TestPolicy insertedPolicy; using (var dbTransaction = await _dbConnectionFactory.BeginUserTransactionAsync(_userId)) { try { insertedPolicy = await _repository.InsertAsync(dbTransaction, newPolicy); Assert.NotNull(insertedPolicy); Assert.NotEqual(0, insertedPolicy.PolicyId); dbTransaction.Commit(); } catch { dbTransaction.Rollback(); throw; } } var newCustomer = A.New <TestCustomer>(); TestCustomer insertedCustomer; using (var dbTransaction = await _dbConnectionFactory.BeginUserTransactionAsync(_userId)) { try { insertedCustomer = await _customersRepository.InsertAsync(dbTransaction, newCustomer); Assert.NotNull(insertedCustomer); Assert.NotEqual(0, insertedCustomer.CustomerId); await _customersRepository.AddCustomerPolicy(dbTransaction, insertedCustomer.CustomerId, insertedPolicy.PolicyId); dbTransaction.Commit(); } catch { dbTransaction.Rollback(); throw; } } using (var dbConnection = await _dbConnectionFactory.OpenUserConnectionAsync(_userId)) { var result = await _repository.GetCustomerPoliciesAsync <TestPolicy>(dbConnection, insertedCustomer.CustomerId); Assert.NotNull(result); } }