public async Task ValidateApprenticeshipForEdit(ValidateApprenticeshipForEditRequest request)
        {
            //Act
            await _controller.ValidateApprenticeshipForEdit(request);

            //Assert
            _mediator.Verify(m => m.Send(
                                 It.IsAny <ValidateApprenticeshipForEditCommand>(),
                                 It.IsAny <CancellationToken>()), Times.Once);
        }
        public async Task ValidateApprenticeshipForEditNotFound(ValidateApprenticeshipForEditRequest request)
        {
            _mapper.Setup(x => x.Map <ValidateApprenticeshipForEditCommand>(request)).ReturnsAsync(() => new ValidateApprenticeshipForEditCommand());
            _mediator.Setup(p => p.Send(It.IsAny <ValidateApprenticeshipForEditCommand>(), It.IsAny <CancellationToken>())).ReturnsAsync(() => null);

            //Act
            await _controller.ValidateApprenticeshipForEdit(request);

            //Assert
            _mediator.Verify(m => m.Send(
                                 It.IsAny <ValidateApprenticeshipForEditCommand>(),
                                 It.IsAny <CancellationToken>()), Times.Once);
        }
Пример #3
0
        public async Task <IActionResult> ValidateApprenticeshipForEdit([FromBody] ValidateApprenticeshipForEditRequest request)
        {
            var command = await _modelMapper.Map <ValidateApprenticeshipForEditCommand>(request);

            var response = await _mediator.Send(command);

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

            return(Ok(response));
        }
Пример #4
0
        public async Task Then_Maps_ValidateApprenticeshipForEditRequestToValidateApprenticeshipForEditCommand(
            ValidateApprenticeshipForEditRequest source,
            ValidateApprenticeshipForEditRequestToValidateApprenticeshipForEditCommand mapper)
        {
            var result = await mapper.Map(source);

            result.ApprenticeshipValidationRequest.ProviderId.Should().Be(source.ProviderId);
            result.ApprenticeshipValidationRequest.EmployerAccountId.Should().Be(source.EmployerAccountId);
            result.ApprenticeshipValidationRequest.ApprenticeshipId.Should().Be(source.ApprenticeshipId);
            result.ApprenticeshipValidationRequest.FirstName.Should().BeEquivalentTo(source.FirstName);
            result.ApprenticeshipValidationRequest.LastName.Should().BeEquivalentTo(source.LastName);
            result.ApprenticeshipValidationRequest.DateOfBirth.Should().Be(source.DateOfBirth);
            result.ApprenticeshipValidationRequest.ULN.Should().BeEquivalentTo(source.ULN);
            result.ApprenticeshipValidationRequest.Cost.Should().Be(source.Cost);
            result.ApprenticeshipValidationRequest.EmployerReference.Should().BeEquivalentTo(source.EmployerReference);
            result.ApprenticeshipValidationRequest.StartDate.Should().Be(source.StartDate);
            result.ApprenticeshipValidationRequest.EndDate.Should().Be(source.EndDate);
            result.ApprenticeshipValidationRequest.CourseCode.Should().BeEquivalentTo(source.TrainingCode);
        }
Пример #5
0
 public Task ValidateApprenticeshipForEdit(ValidateApprenticeshipForEditRequest request, CancellationToken cancellationToken = default)
 {
     return(_client.PostAsJson($"api/apprenticeships/edit/validate", request, cancellationToken));
 }