public void Arrange() { _permissionsResponse = new GetProviderRelationshipsWithPermissionQueryResponse { ProviderRelationships = new List <AccountProviderLegalEntityDto>() }; _mediator = new Mock <IMediator>(); _mediator.Setup(x => x.Send(It.IsAny <GetProviderRelationshipsWithPermissionQueryRequest>(), new CancellationToken())) .ReturnsAsync(_permissionsResponse); _chooseEmployerViewModel = new ChooseEmployerViewModel(); _selectEmployerMapper = new Mock <ISelectEmployerMapper>(); _selectEmployerMapper.Setup(x => x.Map(It.IsAny <IEnumerable <AccountProviderLegalEntityDto> >(), EmployerSelectionAction.CreateCohort)) .Returns(_chooseEmployerViewModel); _orchestrator = new SelectEmployerOrchestrator(_mediator.Object, _selectEmployerMapper.Object, Mock.Of <IHashingService>(), Mock.Of <IProviderCommitmentsLogger>()); }
public void Arrange() { _permissionsResponse = new GetProviderRelationshipsWithPermissionQueryResponse { ProviderRelationships = new List <AccountProviderLegalEntityDto> { new AccountProviderLegalEntityDto { AccountPublicHashedId = _employerAccountPublicHashedId, AccountId = _employerAccountId, AccountLegalEntityId = _employerAccountLegalEntityId, AccountLegalEntityPublicHashedId = _employerAccountLegalEntityPublicHashedId } } }; _hashingService = new Mock <IHashingService>(); _hashingService.Setup(x => x.HashValue(It.Is <long>(l => l == _apiResponse))).Returns("CohortRef"); _publicHashingService = new Mock <IPublicHashingService>(); _publicHashingService.Setup(x => x.DecodeValue(It.Is <string>(s => s == _employerAccountPublicHashedId))).Returns(_employerAccountId); _publicHashingService.Setup(x => x.DecodeValue(It.Is <string>(s => s == _employerAccountLegalEntityPublicHashedId))) .Returns(_employerAccountLegalEntityId); _mediator = new Mock <IMediator>(); _mediator.Setup(x => x.Send(It.IsAny <GetProviderRelationshipsWithPermissionQueryRequest>(), new CancellationToken())) .ReturnsAsync(_permissionsResponse); _provider = new GetProviderQueryResponse { ProvidersView = new ProvidersView { CreatedDate = new DateTime(2018, 11, 6), Provider = new Provider { ProviderName = "Test Provider" } } }; _mediator.Setup(x => x.Send(It.IsAny <GetProviderQueryRequest>(), It.IsAny <CancellationToken>())).ReturnsAsync(_provider); _legalEntity = new LegalEntity { Id = 1, AccountLegalEntityPublicHashedId = _employerAccountLegalEntityPublicHashedId, Code = "code", Name = "Test Legal Entity", RegisteredAddress = "Test Address", Source = 1 }; _mediator.Setup(x => x.Send(It.IsAny <GetEmployerAccountLegalEntitiesRequest>(), It.IsAny <CancellationToken>())).ReturnsAsync( () => new GetEmployerAccountLegalEntitiesResponse { LegalEntities = new List <LegalEntity> { _legalEntity } }); _mediator.Setup(x => x.Send(It.IsAny <CreateCommitmentCommand>(), It.IsAny <CancellationToken>())) .ReturnsAsync(new CreateCommitmentCommandResponse { CommitmentId = _apiResponse }); _signInUserModel = new SignInUserModel { DisplayName = "DisplayName", Email = "*****@*****.**" }; _confirmEmployerViewModel = new ConfirmEmployerViewModel { EmployerAccountLegalEntityPublicHashedId = _employerAccountLegalEntityPublicHashedId, EmployerAccountPublicHashedId = _employerAccountPublicHashedId }; _orchestrator = new CreateCohortOrchestrator(_mediator.Object, _hashingService.Object, Mock.Of <IProviderCommitmentsLogger>(), _publicHashingService.Object); }