Ejemplo n.º 1
0
        public async Task Then_The_Api_Is_Called_With_The_Request_And_The_DraftApprenticeships_Are_Returned(
            GetDraftApprenticeshipsQuery query,
            GetDraftApprenticeshipsResponse apiResponse,
            [Frozen] Mock <ICommitmentsV2ApiClient <CommitmentsV2ApiConfiguration> > apiClient,
            GetDraftApprenticeshipsQueryHandler handler
            )
        {
            apiClient.Setup(x => x.Get <GetDraftApprenticeshipsResponse>(It.Is <GetDraftApprenticeshipsRequest>(x => x.CohortId == query.CohortId))).ReturnsAsync(apiResponse);

            var actual = await handler.Handle(query, CancellationToken.None);

            actual.DraftApprenticeships.Should().BeEquivalentTo(apiResponse.DraftApprenticeships.Select(item => (Approvals.Application.DraftApprenticeships.Queries.DraftApprenticeship)item));
        }
Ejemplo n.º 2
0
            public async Task <GetDraftApprenticeshipsQueryResult> Handle()
            {
                _queryResult = await _queryHandler.Handle(TestHelper.Clone(_query), new CancellationToken());

                return(_queryResult);
            }