public async Task And_Invalid_Id_Specified_Then_No_Opportunity_Returned( int opportunityId, string standardId, GetStandardsListResponse response, [Frozen] Mock <ILevyTransferMatchingService> mockLevyTransferMatchingService, [Frozen] Mock <ICoursesApiClient <CoursesApiConfiguration> > client, GetApplicationDetailsQueryHandler getApplicationDetailsQueryHandler) { var getApplicationDetailsQuery = new GetApplicationDetailsQuery() { StandardId = standardId, OpportunityId = opportunityId }; mockLevyTransferMatchingService .Setup(x => x.GetPledge(It.Is <int>(y => y == opportunityId))) .ReturnsAsync((Pledge)null); client .Setup(x => x.Get <GetStandardsListResponse>(It.IsAny <GetAvailableToStartStandardsListRequest>())) .ReturnsAsync(response); var result = await getApplicationDetailsQueryHandler.Handle(getApplicationDetailsQuery, CancellationToken.None); Assert.IsNull(result.Opportunity); }
public async Task And_No_Id_Specified_Then_All_Standards_Returned( GetStandardsListResponse response, [Frozen] Mock <ICoursesApiClient <CoursesApiConfiguration> > client, GetApplicationDetailsQueryHandler getApplicationDetailsQueryHandler) { var getStandardsQuery = new GetApplicationDetailsQuery(); client .Setup(x => x.Get <GetStandardsListResponse>(It.IsAny <GetAvailableToStartStandardsListRequest>())) .ReturnsAsync(response); var result = await getApplicationDetailsQueryHandler.Handle(getStandardsQuery, CancellationToken.None); Assert.IsNotNull(result); Assert.IsNotNull(result.Standards); Assert.AreEqual(response.Standards.Count(), result.Standards.Count()); client.Verify(x => x.Get <GetStandardsListResponse>(It.IsAny <GetAvailableToStartStandardsListRequest>()), Times.Once); }
public async Task And_Valid_Id_Specified_Then_Standard_Returned( GetStandardsListItem response, [Frozen] Mock <ICoursesApiClient <CoursesApiConfiguration> > client, GetApplicationDetailsQueryHandler getApplicationDetailsQueryHandler) { var getStandardsQuery = new GetApplicationDetailsQuery() { StandardId = "1" }; client .Setup(x => x.Get <GetStandardsListItem>(It.IsAny <GetStandardDetailsByIdRequest>())) .ReturnsAsync(response); var result = await getApplicationDetailsQueryHandler.Handle(getStandardsQuery, CancellationToken.None); Assert.IsNotNull(result); Assert.IsNotNull(result.Standards); Assert.AreEqual(1, result.Standards.Count()); }