public static EmployerIdentityOption ConvertToModelOption(this EmployerNameOption option) { switch (option) { case EmployerNameOption.RegisteredName: return(EmployerIdentityOption.RegisteredName); case EmployerNameOption.TradingName: return(EmployerIdentityOption.ExistingTradingName); case EmployerNameOption.Anonymous: return(EmployerIdentityOption.Anonymous); default: throw new ArgumentException($"Cannot map '{option.ToString()}' to '{nameof(EmployerIdentityOption)}'"); } }
public async Task ShouldReturnThreeDataItems(EmployerNameOption employerNameOption) { var vacancy = _fixture .Build <Vacancy>() .With(r => r.EmployerNameOption, employerNameOption) .Create(); _mockRepository .Setup(r => r.GetVacancyAsync(It.IsAny <long>())) .ReturnsAsync(vacancy); var expectedEmployerName = employerNameOption == EmployerNameOption.TradingName ? vacancy.EmployerName : vacancy.LegalEntityName; var sut = GetSut(); var dataItems = await sut.GetDataItemsAsync(_fixture.Create <long>()); dataItems.Count().Should().Be(3); dataItems.First(t => t.Key == DataItemKeys.Vacancy.VacancyReference).Value.Should().Be(vacancy.VacancyReference.ToString()); dataItems.First(t => t.Key == DataItemKeys.Vacancy.VacancyTitle).Value.Should().Be(vacancy.Title); dataItems.First(t => t.Key == DataItemKeys.Vacancy.EmployerName).Value.Should().Be(expectedEmployerName); }
public async Task WhenEmployerNameOptionUpdated_ShouldFlagEmployerNameFieldIndicator(EmployerNameOption employerNameOption, EmployerIdentityOption employerIdentityOption, string newTradingName, bool shouldFlagIndicator) { _fixture .WithEmployerNameOption(employerNameOption) .WithTradingName(employerNameOption == EmployerNameOption.TradingName ? "this is a value" : null) .Setup(); var locationEditModel = new LocationEditModel { EmployerAccountId = _fixture.Vacancy.EmployerAccountId, VacancyId = _fixture.Vacancy.Id, SelectedLocation = LocationViewModel.UseOtherLocationConst }; await _fixture.PostLocationEditModelAsync(locationEditModel, new VacancyEmployerInfoModel { EmployerIdentityOption = employerIdentityOption, NewTradingName = newTradingName, AccountLegalEntityPublicHashedId = _fixture.Vacancy.AccountLegalEntityPublicHashedId }); _fixture.VerifyEmployerReviewFieldIndicators(FieldIdentifiers.EmployerName, shouldFlagIndicator); }
public LocationOrchestratorTestsFixture WithEmployerNameOption(EmployerNameOption employerNameOption) { Vacancy.EmployerNameOption = employerNameOption; return(this); }