public async Task Then_Gets_Accounts_From_AccountApi( string userId, [Frozen] Mock <IAccountApiClient> mockAccountApiClient, Infrastructure.Services.EmployerAccountService employerAccountService) { mockAccountApiClient .Setup(client => client.GetUserAccounts(It.IsAny <string>())) .ReturnsAsync(_accountDetailViewModels.ToList); await employerAccountService.GetEmployerIdentifiersAsync(userId); mockAccountApiClient.Verify(client => client.GetUserAccounts(userId), Times.Once); }
public async Task Then_Returns_All_Users_For_Account_From_Account_Api( long accountId, List <TeamMemberViewModel> teamMembers, [Frozen] Mock <IAccountApiClient> mockApiClient, Infrastructure.Services.EmployerAccountService service) { mockApiClient .Setup(client => client.GetAccountUsers(accountId)) .ReturnsAsync(teamMembers); var result = await service.GetAccountUsers(accountId); result.Should().BeEquivalentTo(teamMembers); }
public async Task Then_Maps_Accounts_To_EmployerIdentifiers( string userId, [Frozen] Mock <IAccountApiClient> mockAccountApiClient, Infrastructure.Services.EmployerAccountService employerAccountService) { mockAccountApiClient .Setup(client => client.GetUserAccounts(It.IsAny <string>())) .ReturnsAsync(_accountDetailViewModels.ToList); var result = await employerAccountService.GetEmployerIdentifiersAsync(userId); result.Should().BeEquivalentTo(_accountDetailViewModels.Select(model => new EmployerIdentifier { AccountId = model.HashedAccountId, EmployerName = model.DasAccountName })); }
public async Task Then_Gets_Transfer_Accounts_From_AccountApi_And_Maps_To_Model( string accountId, List <TransferConnectionViewModel> apiResponse, [Frozen] Mock <IAccountApiClient> mockAccountApiClient, Infrastructure.Services.EmployerAccountService employerAccountService) { mockAccountApiClient .Setup(client => client.GetTransferConnections(accountId)) .ReturnsAsync(apiResponse); var actual = await employerAccountService.GetTransferConnections(accountId); mockAccountApiClient.Verify(client => client.GetTransferConnections(accountId), Times.Once); actual.Should().BeEquivalentTo(apiResponse.Select(model => new EmployerTransferConnection { FundingEmployerPublicHashedAccountId = model.FundingEmployerPublicHashedAccountId, FundingEmployerAccountName = model.FundingEmployerAccountName, FundingEmployerHashedAccountId = model.FundingEmployerHashedAccountId, FundingEmployerAccountId = model.FundingEmployerAccountId })); }