public async Task And_Application_Doesnt_Exist_Returns_Null( GetAcceptedQuery getAcceptedQuery, [Frozen] Mock <ILevyTransferMatchingService> mockLevyTransferMatchingService, GetAcceptedQueryHandler getAcceptedQueryHandler) { mockLevyTransferMatchingService .Setup(x => x.GetApplication(It.Is <GetApplicationRequest>(y => y.GetUrl.Contains(getAcceptedQuery.ApplicationId.ToString())))) .ReturnsAsync((GetApplicationResponse)null); var result = await getAcceptedQueryHandler.Handle(getAcceptedQuery, CancellationToken.None); Assert.IsNull(result); }
public async Task And_Application_Exists_Response_Returned( GetAcceptedQuery getAcceptedQuery, GetApplicationResponse getApplicationResponse, Models.Pledge pledgeResponse, [Frozen] Mock <ILevyTransferMatchingService> mockLevyTransferMatchingService, GetAcceptedQueryHandler getAcceptedQueryHandler) { mockLevyTransferMatchingService .Setup(x => x.GetApplication(It.Is <GetApplicationRequest>(y => y.GetUrl.Contains(getAcceptedQuery.ApplicationId.ToString())))) .ReturnsAsync(getApplicationResponse); mockLevyTransferMatchingService .Setup(x => x.GetPledge(It.Is <int>(y => y == getApplicationResponse.PledgeId))) .ReturnsAsync(pledgeResponse); var result = await getAcceptedQueryHandler.Handle(getAcceptedQuery, CancellationToken.None); Assert.IsNotNull(result); Assert.AreEqual(pledgeResponse.DasAccountName, result.EmployerAccountName); }