Esempio n. 1
0
 public void Arrange()
 {
     _mockMapper = new Mock <IMapper>();
     _mockCommitmentsApiClient = new Mock <ICommitmentsApiClient>();
     _mockEncodingService      = new Mock <IEncodingService>();
     _sut = new CommitmentsV2Service(_mockCommitmentsApiClient.Object, _mockMapper.Object, _mockEncodingService.Object);
 }
        public void WhenApprenticeshipIsNotFound(
            long accountId,
            long apprenticeshipId,
            [Frozen] Mock <IInternalApiClient <CommitmentsV2Configuration> > client)
        {
            var sut = new CommitmentsV2Service(client.Object);

            sut.Invoking((s) => s.GetApprenticeshipDetails(accountId, apprenticeshipId)).Should().Throw <HttpRequestContentException>();
        }
Esempio n. 3
0
 public SendInvitationRemindersCommandHandler(
     ApprenticeCommitmentsService apprenticeCommitmentsService,
     ApprenticeLoginService apprenticeLoginService,
     CommitmentsV2Service commitmentsV2Service,
     ILogger <SendInvitationRemindersCommandHandler> logger)
 {
     _apprenticeCommitmentsService = apprenticeCommitmentsService;
     _apprenticeLoginService       = apprenticeLoginService;
     _commitmentsV2Service         = commitmentsV2Service;
     _logger = logger;
 }
        public async Task WhenApprenticeshipIsFoundAndTheAccountIdMatches(
            long accountId,
            long apprenticeshipId,
            [Frozen] Mock <IInternalApiClient <CommitmentsV2Configuration> > client)
        {
            ClientReturnsApprenticeshipWith(client, accountId, apprenticeshipId);

            var sut      = new CommitmentsV2Service(client.Object);
            var response = await sut.GetApprenticeshipDetails(accountId, apprenticeshipId);

            response.EmployerAccountId.Should().Be(accountId);
            response.Id.Should().Be(apprenticeshipId);
        }
Esempio n. 5
0
 public CreateApprenticeshipCommandHandler(
     ApprenticeCommitmentsService apprenticeCommitmentsService,
     ApprenticeLoginService apprenticeLoginService,
     CommitmentsV2Service commitmentsV2Service,
     TrainingProviderService trainingProviderService,
     CoursesService coursesService)
 {
     _apprenticeCommitmentsService = apprenticeCommitmentsService;
     _apprenticeLoginService       = apprenticeLoginService;
     _commitmentsService           = commitmentsV2Service;
     _trainingProviderService      = trainingProviderService;
     _coursesService = coursesService;
 }
 public UpdateApprovalCommandHandler(
     ApprenticeCommitmentsService apprenticeCommitmentsService,
     CommitmentsV2Service commitmentsV2Service,
     TrainingProviderService trainingProviderService,
     CoursesService coursesService,
     ILogger <UpdateApprovalCommandHandler> logger)
 {
     _apprenticeCommitmentsService = apprenticeCommitmentsService;
     _commitmentsService           = commitmentsV2Service;
     _trainingProviderService      = trainingProviderService;
     _coursesService = coursesService;
     _logger         = logger;
 }
Esempio n. 7
0
 public CreateApprovalCommandHandler(
     ApprenticeCommitmentsService apprenticeCommitmentsService,
     ApprenticeLoginConfiguration loginConfiguration,
     CommitmentsV2Service commitmentsV2Service,
     TrainingProviderService trainingProviderService,
     CoursesService coursesService,
     ILogger <CreateApprovalCommandHandler> logger)
 {
     _apprenticeCommitmentsService = apprenticeCommitmentsService;
     _loginConfiguration           = loginConfiguration;
     _commitmentsService           = commitmentsV2Service;
     _trainingProviderService      = trainingProviderService;
     _coursesService = coursesService;
     _logger         = logger;
 }
        public void WhenApprenticeshipIsNotFound(
            long accountId,
            long apprenticeshipId,
            [Frozen] Mock <IInternalApiClient <CommitmentsV2Configuration> > client)
        {
            client
            .Setup(x =>
                   x.GetWithResponseCode <Apis.CommitmentsV2InnerApi.ApprenticeshipResponse>(
                       It.IsAny <Apis.CommitmentsV2InnerApi.GetApprenticeshipDetailsRequest>()))
            .ReturnsAsync(new ApiResponse <Apis.CommitmentsV2InnerApi.ApprenticeshipResponse>(
                              null, HttpStatusCode.NotFound, ""));
            var sut = new CommitmentsV2Service(client.Object);

            sut.Invoking((s) => s.GetApprenticeshipDetails(accountId, apprenticeshipId)).Should().Throw <HttpRequestContentException>();
        }
Esempio n. 9
0
 public CommitmentsV2HealthCheck(CommitmentsV2Service service)
 {
     _service = service;
 }