public SelectEmployerViewModelMapperFixture() { _providerId = 123; _request = new SelectEmployerRequest { ProviderId = _providerId }; _apiResponse = new GetAccountProviderLegalEntitiesWithPermissionResponse { AccountProviderLegalEntities = new List <AccountProviderLegalEntityDto> { new AccountProviderLegalEntityDto { AccountId = 123, AccountLegalEntityPublicHashedId = "DSFF23", AccountLegalEntityName = "TestAccountLegalEntityName", AccountPublicHashedId = "DFKFK66", AccountName = "TestAccountName", AccountLegalEntityId = 456, AccountProviderId = 234 } } }; _providerRelationshipsApiClientMock = new Mock <IProviderRelationshipsApiClient>(); _providerRelationshipsApiClientMock .Setup(x => x.GetAccountProviderLegalEntitiesWithPermission( It.IsAny <GetAccountProviderLegalEntitiesWithPermissionRequest>(), CancellationToken.None)) .ReturnsAsync(() => _apiResponse); _sut = new SelectEmployerViewModelMapper(_providerRelationshipsApiClientMock.Object); }
public SelectEmployerViewModelMapperFixture() { _providerId = 123; _accountLegalEntityId = 457; _apprenticeshipId = 1; _request = new SelectEmployerRequest { ProviderId = _providerId, ApprenticeshipId = _apprenticeshipId }; _apiResponse = new GetAccountProviderLegalEntitiesWithPermissionResponse { AccountProviderLegalEntities = new List <AccountProviderLegalEntityDto> { new AccountProviderLegalEntityDto { AccountId = 123, AccountLegalEntityPublicHashedId = "DSFF23", AccountLegalEntityName = "TestAccountLegalEntityName", AccountPublicHashedId = "DFKFK66", AccountName = "TestAccountName", AccountLegalEntityId = 456, AccountProviderId = 234 }, new AccountProviderLegalEntityDto { AccountId = 124, AccountLegalEntityPublicHashedId = "DSFF24", AccountLegalEntityName = "TestAccountLegalEntityName2", AccountPublicHashedId = "DFKFK67", AccountName = "TestAccountNam2", AccountLegalEntityId = _accountLegalEntityId, AccountProviderId = 235 } } }; GetApprenticeshipApiResponse = new CommitmentsV2.Api.Types.Responses.GetApprenticeshipResponse { AccountLegalEntityId = _accountLegalEntityId, EmployerName = "TestName" }; _providerRelationshipsApiClientMock = new Mock <IProviderRelationshipsApiClient>(); _providerRelationshipsApiClientMock .Setup(x => x.GetAccountProviderLegalEntitiesWithPermission( It.IsAny <GetAccountProviderLegalEntitiesWithPermissionRequest>(), CancellationToken.None)) .ReturnsAsync(_apiResponse); _commitmentApiClientMock = new Mock <ICommitmentsApiClient>(); _commitmentApiClientMock.Setup(x => x.GetApprenticeship(_apprenticeshipId, It.IsAny <CancellationToken>())) .ReturnsAsync(GetApprenticeshipApiResponse); _sut = new SelectEmployerViewModelMapper(_providerRelationshipsApiClientMock.Object, _commitmentApiClientMock.Object); }
public async Task TheResultIsReturnedFromTheRelationshipsApiClient() { //Arrange var apiResponse = new GetAccountProviderLegalEntitiesWithPermissionResponse { AccountProviderLegalEntities = new List <AccountProviderLegalEntityDto>() }; _apiClient.Setup(x => x.GetAccountProviderLegalEntitiesWithPermission(It.IsAny <GetAccountProviderLegalEntitiesWithPermissionRequest>(), It.IsAny <CancellationToken>())) .ReturnsAsync(apiResponse); //Act var result = await _handler.Handle(TestHelper.Clone(_validRequest), new CancellationToken()); //Assert Assert.AreEqual(result.ProviderRelationships, apiResponse.AccountProviderLegalEntities); }
public ProviderRelationshipsApiClientTestsFixture() { GetAccountProviderLegalEntitiesWithPermissionResponse = new GetAccountProviderLegalEntitiesWithPermissionResponse { AccountProviderLegalEntities = new List <AccountProviderLegalEntityDto>() }; Relationships = new List <AccountProviderLegalEntityDto>(); CancellationToken = CancellationToken.None; HttpMessageHandler = new FakeHttpMessageHandler(); HttpClient = new HttpClient(HttpMessageHandler) { BaseAddress = new Uri("https://foo.bar") }; RestHttpClient = new RestHttpClient(HttpClient); Mediator = new Mock <IMediator>(); SetupHttpClientGetToReturnAccountProviderLegalEntitiesResponse(); ProviderRelationshipsApiClient = new ProviderRelationshipsApiClient(RestHttpClient, Mediator.Object); }
public SelectEmployerViewModelMapperFixture AddListOfAccountProviderLegalEntities() { _apiResponse = new GetAccountProviderLegalEntitiesWithPermissionResponse { AccountProviderLegalEntities = new List <AccountProviderLegalEntityDto> { new AccountProviderLegalEntityDto { AccountId = 123, AccountLegalEntityPublicHashedId = "ADSFF23", AccountLegalEntityName = "ATestAccountLegalEntityName", AccountPublicHashedId = "ADFKFK66", AccountName = "CTestAccountName", AccountLegalEntityId = 456, AccountProviderId = 234 }, new AccountProviderLegalEntityDto { AccountId = 123, AccountLegalEntityPublicHashedId = "BDSFF23", AccountLegalEntityName = "BTestAccountLegalEntityName", AccountPublicHashedId = "BDFKFK66", AccountName = "BTestAccountName", AccountLegalEntityId = 456, AccountProviderId = 234 }, new AccountProviderLegalEntityDto { AccountId = 123, AccountLegalEntityPublicHashedId = "CDSFF23", AccountLegalEntityName = "CTestAccountLegalEntityName", AccountPublicHashedId = "CDFKFK66", AccountName = "ATestAccountName", AccountLegalEntityId = 456, AccountProviderId = 234 } } }; return(this); }