Exemple #1
0
        public async Task <IActionResult> Get(long cohortId, long apprenticeshipId)
        {
            var command = new GetDraftApprenticeshipQuery(cohortId, apprenticeshipId);

            var response = await _mediator.Send(command);

            if (response == null)
            {
                return(NotFound());
            }

            return(Ok(await _getDraftApprenticeshipMapper.Map(response)));
        }
        public void Validate_WhenValidatingApprenticeshipId_ThenShouldRejectNonPositiveNumbers(long draftApprenticeshipId, bool expectToBeValid)
        {
            // arrange
            var validator = new GetDraftApprenticeshipQueryValidator();
            var request   = new GetDraftApprenticeshipQuery(1, draftApprenticeshipId);

            // act
            if (expectToBeValid)
            {
                validator.ShouldNotHaveValidationErrorFor(r => r.DraftApprenticeshipId, request, null);
            }
            else
            {
                validator.ShouldHaveValidationErrorFor(r => r.DraftApprenticeshipId, request, null);
            }
        }
Exemple #3
0
        public Task <GetDraftApprenticeshipQueryResult> Handle()
        {
            var query = new GetDraftApprenticeshipQuery(CohortId, ApprenticeshipId);

            return(Handler.Handle(query, CancellationToken.None));
        }