public void ShouldNotShowHoursPerWeekWhenApprenticeshipHasNoHoursPerWeekSet(double?hoursPerWeek, bool expectValid) { //Arrange var viewModel = new VacancyViewModel() { ProviderSite = new ProviderSiteViewModel() { Address = new AddressViewModel() }, FurtherVacancyDetailsViewModel = new FurtherVacancyDetailsViewModel { VacancyDatesViewModel = new VacancyDatesViewModel { ClosingDate = new DateViewModel(DateTime.Now), PossibleStartDate = new DateViewModel(DateTime.Now) }, VacancyType = VacancyType.Apprenticeship, Wage = new WageViewModel() { HoursPerWeek = (decimal?)hoursPerWeek } }, NewVacancyViewModel = new NewVacancyViewModel { VacancyOwnerRelationship = new VacancyOwnerRelationshipViewModel() { Employer = new EmployerViewModel() { Address = new AddressViewModel() } }, LocationAddresses = new List <VacancyLocationAddressViewModel>(), OfflineVacancy = false }, TrainingDetailsViewModel = new TrainingDetailsViewModel(), VacancyQuestionsViewModel = new VacancyQuestionsViewModel(), VacancyRequirementsProspectsViewModel = new VacancyRequirementsProspectsViewModel(), Status = VacancyStatus.ReservedForQA, VacancyType = VacancyType.Apprenticeship }; var details = new WorkingWeekAndWage(); //Act var view = details.RenderAsHtml(viewModel); //Assert var totalHoursPerWeek = view.GetElementbyId("total-hours-per-week"); if (expectValid) { totalHoursPerWeek.Should().NotBeNull(); } else { totalHoursPerWeek.Should().BeNull(); } }
public void ShouldShowCustomWageAmount(decimal wage, WageUnit wageUnit, string expectedDisplayText) { var details = new WorkingWeekAndWage(); var viewModel = new VacancyViewModel() { ProviderSite = new ProviderSiteViewModel() { Address = new AddressViewModel() }, FurtherVacancyDetailsViewModel = new FurtherVacancyDetailsViewModel { VacancyDatesViewModel = new VacancyDatesViewModel { ClosingDate = new DateViewModel(DateTime.Now), PossibleStartDate = new DateViewModel(DateTime.Now) }, Wage = new WageViewModel() { Amount = wage, Unit = wageUnit } }, NewVacancyViewModel = new NewVacancyViewModel { VacancyOwnerRelationship = new VacancyOwnerRelationshipViewModel() { Employer = new EmployerViewModel() { Address = new AddressViewModel() } }, LocationAddresses = new List <VacancyLocationAddressViewModel>(), OfflineVacancy = false }, TrainingDetailsViewModel = new TrainingDetailsViewModel(), VacancyQuestionsViewModel = new VacancyQuestionsViewModel(), VacancyRequirementsProspectsViewModel = new VacancyRequirementsProspectsViewModel(), Status = VacancyStatus.Draft, VacancyType = VacancyType.Apprenticeship }; var view = details.RenderAsHtml(_context, viewModel); view.GetElementbyId("vacancy-wage").InnerHtml.Should().Be(expectedDisplayText); }
public void ShouldShowWageText(WageType wagetype, WageClassification classification, decimal hoursPerWeek, string expectedDisplayText) { var details = new WorkingWeekAndWage(); var viewModel = new VacancyViewModel { ProviderSite = new ProviderSiteViewModel() { Address = new AddressViewModel() }, FurtherVacancyDetailsViewModel = new FurtherVacancyDetailsViewModel { VacancyDatesViewModel = new VacancyDatesViewModel { ClosingDate = new DateViewModel(new DateTime(2016, 09, 01)), PossibleStartDate = new DateViewModel(new DateTime(2016, 09, 08)) }, Wage = new WageViewModel() { Type = wagetype, Classification = classification, Unit = WageUnit.NotApplicable, HoursPerWeek = hoursPerWeek } }, NewVacancyViewModel = new NewVacancyViewModel { VacancyOwnerRelationship = new VacancyOwnerRelationshipViewModel() { Employer = new EmployerViewModel() { Address = new AddressViewModel() } }, LocationAddresses = new List <VacancyLocationAddressViewModel>(), OfflineVacancy = false }, TrainingDetailsViewModel = new TrainingDetailsViewModel(), VacancyQuestionsViewModel = new VacancyQuestionsViewModel(), VacancyRequirementsProspectsViewModel = new VacancyRequirementsProspectsViewModel(), Status = VacancyStatus.ReservedForQA, VacancyType = VacancyType.Apprenticeship }; var view = details.RenderAsHtml(_context, viewModel); view.GetElementbyId("vacancy-wage").InnerHtml.Should().Be(expectedDisplayText); }