public async Task When_PledgeApplicationId_Has_No_Value_Return_False_If_TransferConnection_Does_Not_Exist( GetTransferValidityQuery query, List <TransferConnection> transferConnections, [Frozen] Mock <IAccountsApiClient <AccountsConfiguration> > mockAccountsApiClient, [Frozen] Mock <ILevyTransferMatchingApiClient <LevyTransferMatchingApiConfiguration> > mockApiClient, GetTransferValidityQueryHandler handler) { query.PledgeApplicationId = null; transferConnections = new List <TransferConnection>(); mockAccountsApiClient .Setup(client => client.GetAll <TransferConnection>(It.IsAny <GetTransferConnectionsRequest>())) .ReturnsAsync(transferConnections); var result = await handler.Handle(query, CancellationToken.None); Assert.IsFalse(result.IsValid); }
public async Task When_PledgeApplicationId_Has_Value_Return_False_If_PledgeApplication_Is_Not_Accepted( GetTransferValidityQuery query, GetPledgeApplicationResponse pledgeApplication, [Frozen] Mock <IAccountsApiClient <AccountsConfiguration> > mockAccountsApiClient, [Frozen] Mock <ILevyTransferMatchingApiClient <LevyTransferMatchingApiConfiguration> > mockApiClient, GetTransferValidityQueryHandler handler) { pledgeApplication.ReceiverEmployerAccountId = query.ReceiverId; pledgeApplication.SenderEmployerAccountId = query.SenderId; pledgeApplication.Status = "Declined"; mockApiClient .Setup(client => client.Get <GetPledgeApplicationResponse>(It.IsAny <GetPledgeApplicationRequest>())) .ReturnsAsync(pledgeApplication); var result = await handler.Handle(query, CancellationToken.None); Assert.IsFalse(result.IsValid); }