public void Arrange()
        {
            var fixture = new Fixture();

            _cohortReference = fixture.Create <string>();
            _encodedDraftApprenticeshipId = fixture.Create <string>();
            var encodingService = new Mock <IEncodingService>();

            encodingService.Setup(x => x.Encode(It.IsAny <long>(), EncodingType.CohortReference))
            .Returns(_cohortReference);
            encodingService.Setup(x => x.Encode(It.IsAny <long>(), EncodingType.ApprenticeshipId))
            .Returns(_encodedDraftApprenticeshipId);

            _apiResponse = fixture.Build <GetDraftApprenticeshipResponse>().Create();
            var commitmentsApiClient = new Mock <ICommitmentsApiClient>();

            commitmentsApiClient.Setup(x =>
                                       x.GetDraftApprenticeship(It.IsAny <long>(), It.IsAny <long>(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(_apiResponse);

            _mapper = new EditDraftApprenticeshipViewModelMapper(encodingService.Object, commitmentsApiClient.Object);
            _source = fixture.Build <EditDraftApprenticeshipRequest>().Create();

            _act = async() => await _mapper.Map(TestHelper.Clone(_source));
        }
예제 #2
0
        public void Arrange()
        {
            var fixture = new Fixture();

            _mapper = new EditDraftApprenticeshipViewModelMapper();
            _source = fixture.Build <EditDraftApprenticeshipDetails>().Create();

            _act = async() => await _mapper.Map(TestHelper.Clone(_source));
        }
예제 #3
0
        public async Task Arrange()
        {
            var autoFixture = new Fixture();

            _allTrainingProgrammes      = autoFixture.CreateMany <TrainingProgramme>().ToList();
            _standardTrainingProgrammes = autoFixture.CreateMany <TrainingProgramme>().ToList();
            _encodedApprenticeshipId    = autoFixture.Create <string>();
            _cohortReference            = autoFixture.Create <string>();

            _encodingService = new Mock <IEncodingService>();
            _encodingService
            .Setup(x => x.Encode(It.IsAny <long>(), It.Is <EncodingType>(e => e == EncodingType.ApprenticeshipId)))
            .Returns(_encodedApprenticeshipId);
            _encodingService
            .Setup(x => x.Encode(It.IsAny <long>(), It.Is <EncodingType>(e => e == EncodingType.CohortReference)))
            .Returns(_cohortReference);

            _draftApprenticeshipResponse = autoFixture.Create <GetDraftApprenticeshipResponse>();
            _draftApprenticeshipResponse.IsContinuation = false;
            _commitmentsApiClient = new Mock <ICommitmentsApiClient>();
            _commitmentsApiClient.Setup(x =>
                                        x.GetDraftApprenticeship(It.IsAny <long>(), It.IsAny <long>(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(_draftApprenticeshipResponse);
            _commitmentsApiClient
            .Setup(x => x.GetAllTrainingProgrammeStandards(It.IsAny <CancellationToken>()))
            .ReturnsAsync(new GetAllTrainingProgrammeStandardsResponse
            {
                TrainingProgrammes = _standardTrainingProgrammes
            });

            _commitmentsApiClient
            .Setup(x => x.GetAllTrainingProgrammes(It.IsAny <CancellationToken>()))
            .ReturnsAsync(new GetAllTrainingProgrammesResponse
            {
                TrainingProgrammes = _allTrainingProgrammes
            });

            _cohort           = autoFixture.Create <GetCohortResponse>();
            _cohort.WithParty = Party.Employer;
            _cohort.ChangeOfPartyRequestId = null;
            _commitmentsApiClient.Setup(x => x.GetCohort(It.IsAny <long>(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(_cohort);

            _source        = autoFixture.Create <EditDraftApprenticeshipRequest>();
            _source.Cohort = _cohort;
            _mapper        = new EditDraftApprenticeshipViewModelMapper(_commitmentsApiClient.Object, _encodingService.Object);

            _result = await _mapper.Map(TestHelper.Clone(_source)) as EditDraftApprenticeshipViewModel;
        }
        public void Arrange()
        {
            var fixture = new Fixture();

            _cohortReference = fixture.Create <string>();

            _apiResponse = fixture.Build <GetDraftApprenticeshipResponse>().Create();
            var commitmentsApiClient = new Mock <ICommitmentsApiClient>();

            commitmentsApiClient.Setup(x =>
                                       x.GetDraftApprenticeship(It.IsAny <long>(), It.IsAny <long>(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(_apiResponse);

            _authorizationService = new Mock <IAuthorizationService>();

            _mapper = new EditDraftApprenticeshipViewModelMapper(commitmentsApiClient.Object, _authorizationService.Object);
            _source = fixture.Build <EditDraftApprenticeshipRequest>().Create();

            _act = async() => (await _mapper.Map(TestHelper.Clone(_source))) as EditDraftApprenticeshipViewModel;
        }