public void Arrange() { var fixture = new Fixture(); _source = fixture.Build <CreateCohortWithDraftApprenticeshipRequest>().With(x => x.StartMonthYear, "042020").Create(); _accountLegalEntityResponse = fixture.Create <AccountLegalEntityResponse>(); _trainingCoursesQueryResponse = fixture.Create <GetTrainingCoursesQueryResponse>(); _commitmentsApiClient = new Mock <ICommitmentsApiClient>(); _commitmentsApiClient.Setup(x => x.GetAccountLegalEntity(_source.AccountLegalEntityId, It.IsAny <CancellationToken>())) .ReturnsAsync(_accountLegalEntityResponse); _mediator = new Mock <IMediator>(); _mediator.Setup(x => x.Send(It.IsAny <GetTrainingCoursesQueryRequest>(), It.IsAny <CancellationToken>())) .ReturnsAsync(_trainingCoursesQueryResponse); _mapper = new AddDraftApprenticeshipViewModelMapper(_commitmentsApiClient.Object, _mediator.Object); }
public async Task Arrange() { var autoFixture = new Fixture(); _allTrainingProgrammes = autoFixture.CreateMany <TrainingProgramme>().ToList(); _standardTrainingProgrammes = autoFixture.CreateMany <TrainingProgramme>().ToList(); _cohort = autoFixture.Create <GetCohortResponse>(); _cohort.WithParty = Party.Employer; _commitmentsApiClient = new Mock <ICommitmentsApiClient>(); _commitmentsApiClient.Setup(x => x.GetCohort(It.IsAny <long>(), It.IsAny <CancellationToken>())) .ReturnsAsync(_cohort); _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 }); _encodedTransferSenderId = autoFixture.Create <string>(); _encodingService = new Mock <IEncodingService>(); _encodingService .Setup(x => x.Encode(It.IsAny <long>(), It.Is <EncodingType>(e => e == EncodingType.PublicAccountId))) .Returns(_encodedTransferSenderId); _mapper = new AddDraftApprenticeshipViewModelMapper(_commitmentsApiClient.Object, _encodingService.Object); _source = autoFixture.Create <AddDraftApprenticeshipRequest>(); _source.StartMonthYear = "092020"; _result = await _mapper.Map(TestHelper.Clone(_source)); }
public async Task Arrange() { var autoFixture = new Fixture(); _standardTrainingProgrammes = autoFixture.CreateMany <TrainingProgramme>().ToList(); _allTrainingProgrammes = autoFixture.CreateMany <TrainingProgramme>().ToList(); _providerResponse = autoFixture.Create <GetProviderResponse>(); _accountLegalEntityResponse = autoFixture.Build <AccountLegalEntityResponse>().With(x => x.LevyStatus, ApprenticeshipEmployerType.Levy).Create(); _source = autoFixture.Build <ApprenticeRequest>() .With(x => x.StartMonthYear, "062020") .With(x => x.AccountId, 12345) .Without(x => x.TransferSenderId).Create(); _commitmentsApiClient = new Mock <ICommitmentsApiClient>(); _commitmentsApiClient.Setup(x => x.GetProvider(It.IsAny <long>(), It.IsAny <CancellationToken>())) .ReturnsAsync(_providerResponse); _commitmentsApiClient.Setup(x => x.GetAccountLegalEntity(_source.AccountLegalEntityId, It.IsAny <CancellationToken>())) .ReturnsAsync(_accountLegalEntityResponse); _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 }); _mapper = new AddDraftApprenticeshipViewModelMapper(_commitmentsApiClient.Object); _result = await _mapper.Map(TestHelper.Clone(_source)); }