예제 #1
0
        public void ShouldShowWageRangeInputsWhenWageRangeIsSelected()
        {
            var details = new FurtherVacancyDetails();

            var viewModel = new Fixture().Build <FurtherVacancyDetailsViewModel>()
                            .With(v => v.Status, VacancyStatus.Draft)
                            .With(v => v.Wage, new WageViewModel()
            {
                Classification = WageClassification.Custom, CustomType = CustomWageType.Ranged, AmountLowerBound = 200, AmountUpperBound = 500, Unit = WageUnit.Weekly
            })
                            .With(v => v.WageUnits, ApprenticeshipVacancyConverter.GetWageUnits())
                            .Create();

            var view = details.RenderAsHtml(viewModel);

            view.GetElementbyId("custom-wage").Attributes["checked"].Value.Should().Be("checked");
            view.GetElementbyId("custom-wage-fixed").Attributes["checked"]?.Value.Should().NotBe("checked");
            view.GetElementbyId("custom-wage-range").Attributes["checked"].Value.Should().Be("checked");
            view.GetElementbyId("Wage_AmountLowerBound").Should().NotBeNull();
            view.GetElementbyId("Wage_AmountLowerBound").Attributes["value"].Value.Should().Be("200");
            view.GetElementbyId("Wage_AmountUpperBound").Attributes["value"].Value.Should().Be("500");
            view.GetElementbyId("Wage_RangeUnit").Should().NotBeNull();
            view.GetElementbyId("Wage_RangeUnit")
            .ChildNodes.Any(cn => cn.Attributes["value"].Value == WageUnit.Weekly.ToString()).Should().BeTrue();
        }
예제 #2
0
        public void ShouldShowTextDropdownAndReasonBoxWhenChooseTextIsSelected(PresetText wageType)
        {
            var details = new FurtherVacancyDetails();

            var viewModel = new Fixture().Build <FurtherVacancyDetailsViewModel>()
                            .With(v => v.Status, VacancyStatus.Draft)
                            .With(v => v.Wage, new WageViewModel()
            {
                Classification = WageClassification.LegacyText, PresetText = wageType
            })
                            .With(v => v.WageTextPresets, ApprenticeshipVacancyConverter.GetWageTextPresets())
                            .Create();

            var view = details.RenderAsHtml(viewModel);

            //TODO: Our HTML is invalid.  This causes the browser to fail to set the "checked" property.
            //A quick W3C check on this page resulted in 136 errors and 8 warnings.
            //This is not good at all.  The input appears to be selected but does not have the property.
            //So, we can't verify as we should.
            //view.GetElementbyId("preset-text").Attributes["checked"].Value.Should().Be("checked");

            view.GetElementbyId("Wage_PresetText").Should().NotBeNull();
            view.GetElementbyId("Wage_PresetText").ChildNodes.Any(x => x.Attributes.Contains("selected") && x.Attributes["selected"].Value == "selected").Should().BeTrue();
            view.GetElementbyId("Wage_PresetText").ChildNodes.Single(x => x.Attributes.Contains("selected") && x.Attributes["selected"].Value == "selected").Attributes["value"].Value.Should().Be(((int)wageType).ToString());
            view.GetElementbyId("Wage_WageTypeReason").Should().NotBeNull();
        }
예제 #3
0
        public void ShouldShowFixedWageAndWageRangeRadiosWhenCustomWageIsSelected(CustomWageType wageType)
        {
            var details = new FurtherVacancyDetails();

            var viewModel = new Fixture().Build <FurtherVacancyDetailsViewModel>()
                            .With(v => v.Status, VacancyStatus.Draft)
                            .With(v => v.Wage, new WageViewModel()
            {
                Classification = WageClassification.Custom, CustomType = wageType
            })
                            .Create();

            var view = details.RenderAsHtml(viewModel);

            view.GetElementbyId("custom-wage").Attributes["checked"].Value.Should().Be("checked");
            view.GetElementbyId("custom-wage-fixed").Should().NotBeNull();
            view.GetElementbyId("custom-wage-range").Should().NotBeNull();

            if (wageType == CustomWageType.Fixed)
            {
                view.GetElementbyId("custom-wage-fixed").Attributes["checked"].Value.Should().Be("checked");
            }
            else
            {
                view.GetElementbyId("custom-wage-range").Attributes["checked"].Value.Should().Be("checked");
            }
        }
예제 #4
0
        public void ShouldNotHaveWageWhenTraineeship()
        {
            //Arrange
            var viewModel = new Fixture().Build <FurtherVacancyDetailsViewModel>()
                            .With(vm => vm.VacancyType, VacancyType.Traineeship)
                            .With(vm => vm.Wage, dummyWageViewModel)
                            .Create();
            var details = new FurtherVacancyDetails();

            //Act
            var view = details.RenderAsHtml(viewModel);

            //Assert
            view.GetElementbyId("custom-wage").Should().BeNull();
            view.GetElementbyId("national-minimum-wage").Should().BeNull();
            view.GetElementbyId("apprenticeship-minimum-wage").Should().BeNull();
            var wageType = view.GetElementbyId("Wage_Type");

            wageType.Should().NotBeNull();
            wageType.Attributes["type"].Value.Should().Be("hidden");
            var wage = view.GetElementbyId("Wage_Amount");

            wage.Should().NotBeNull();
            wage.Attributes["type"].Value.Should().Be("hidden");
            var wageUnit = view.GetElementbyId("Wage_Unit");

            wageUnit.Should().NotBeNull();
            wageUnit.Attributes["type"].Value.Should().Be("hidden");
        }
예제 #5
0
        public void ShouldAlwaysShowChooseTextDescriptionRadio()
        {
            var details = new FurtherVacancyDetails();

            var viewModel = new Fixture().Build <FurtherVacancyDetailsViewModel>()
                            .With(v => v.Status, VacancyStatus.Referred)
                            .Create();

            var view = details.RenderAsHtml(viewModel);

            view.GetElementbyId("preset-text").Should().NotBeNull();
        }
예제 #6
0
        public void ApprenticeshipHeading()
        {
            //Arrange
            var viewModel = new Fixture().Build <FurtherVacancyDetailsViewModel>()
                            .With(vm => vm.VacancyType, VacancyType.Apprenticeship)
                            .Create();
            var details = new FurtherVacancyDetails();

            //Act
            var view = details.RenderAsHtml(viewModel);

            view.GetElementbyId("heading").Should().NotBeNull();
            view.GetElementbyId("heading").InnerText.Should().Contain("Enter further details");
        }
예제 #7
0
        public void ShouldNoDisplayLegacyExpectedDurationWhenVacancySourceIsRaa()
        {
            //Arrange
            var viewModel = new Fixture().Build <FurtherVacancyDetailsViewModel>()
                            .With(v => v.VacancySource, VacancySource.Raa)
                            .Create();
            var details = new FurtherVacancyDetails();

            //Act
            var view = details.RenderAsHtml(viewModel);

            //Assert
            var expectedDuration = view.GetElementbyId("ExpectedDuration");

            expectedDuration.Should().BeNull();
        }
예제 #8
0
        public void ShouldNotHaveHoursPerWeekWhenTraineeship()
        {
            //Arrange
            var viewModel = new Fixture().Build <FurtherVacancyDetailsViewModel>()
                            .With(vm => vm.VacancyType, VacancyType.Traineeship)
                            .With(vm => vm.Wage, dummyWageViewModel)
                            .Create();
            var details = new FurtherVacancyDetails();

            //Act
            var view = details.RenderAsHtml(viewModel);

            //Assert
            var hoursPerWeek = view.GetElementbyId("Wage_HoursPerWeek");

            hoursPerWeek.Should().NotBeNull();
            hoursPerWeek.Attributes["type"].Value.Should().Be("hidden");
        }
예제 #9
0
        public void TraineeshipWorkingWeekLabel()
        {
            //Arrange
            var viewModel = new Fixture().Build <FurtherVacancyDetailsViewModel>()
                            .With(vm => vm.VacancyType, VacancyType.Traineeship)
                            .Create();
            var details = new FurtherVacancyDetails();

            //Act
            var view = details.RenderAsHtml(viewModel);

            //Assert
            var workingWeek = view.GetElementbyId("WorkingWeek");

            workingWeek.Should().NotBeNull();
            var label = workingWeek.PreviousSibling;

            label.Should().NotBeNull();
            label.InnerText.Should().Be("Weekly hours");
        }
예제 #10
0
        public void ShouldDisplayWageAmount()
        {
            //Arrange
            var viewModel = new Fixture().Build <FurtherVacancyDetailsViewModel>()
                            .With(vm => vm.VacancyType, VacancyType.Apprenticeship)
                            .With(vm => vm.Wage, new WageViewModel()
            {
                CustomType = CustomWageType.Fixed, Amount = 123.45m
            })
                            .Create();
            var details = new FurtherVacancyDetails();

            //Act
            var view = details.RenderAsHtml(viewModel);

            //Assert
            var wage = view.GetElementbyId("Wage_Amount");

            wage.Should().NotBeNull();
            wage.GetAttributeValue("value", "").Should().Be("123.45");
        }
예제 #11
0
        public void ShouldDisplayHoursPerWeek()
        {
            //Arrange
            var viewModel = new Fixture().Build <FurtherVacancyDetailsViewModel>()
                            .With(vm => vm.VacancyType, VacancyType.Apprenticeship)
                            .With(vm => vm.Wage, new WageViewModel()
            {
                CustomType = CustomWageType.Fixed, HoursPerWeek = 37.5m
            })
                            .Create();
            var details = new FurtherVacancyDetails();

            //Act
            var view = details.RenderAsHtml(viewModel);

            //Assert
            var hoursPerWeek = view.GetElementbyId("Wage_HoursPerWeek");

            hoursPerWeek.Should().NotBeNull();
            hoursPerWeek.GetAttributeValue("value", "").Should().Be("37.5");
        }