Пример #1
0
        public void LiveVacanciesWithLegacyWeeklyWageTypeShouldHaveWageSetFromWeeklyWage()
        {
            const int weeklyWage          = 2550;
            const int vacancyReference    = 1234;
            const int liveVacancyStatusId = 2;

            var provideSettings = new Mock <IProvideSettings>();
            var sut             = new Register.Api.Mappings.ApprenticeshipMapper(provideSettings.Object);

            var apprenticeshipVacancy = new Fixture().Build <ApprenticeshipVacancy>()
                                        .With(v => v.VacancyReferenceNumber, vacancyReference)
                                        .With(v => v.ApprenticeshipTypeId, 1)
                                        .With(v => v.VacancyStatusId, liveVacancyStatusId)
                                        .With(v => v.WageType, (int)LegacyWageType.LegacyWeekly)
                                        .With(v => v.WeeklyWage, weeklyWage)
                                        .Without(v => v.WageText)
                                        .With(v => v.WageUnitId, 2)
                                        .Create();

            var vacancy = sut.MapToApprenticeshipVacancy(apprenticeshipVacancy);

            vacancy.VacancyReference.Should().Be(vacancyReference);
            vacancy.WageUnit.Should().Be(ApiTypes.WageUnit.Weekly);
            vacancy.WageText.Should().Be("£2,550.00");
        }
        public void ShouldHaveWageSetForVacanciesWithCustomRangeWageType(int wageUnitId, ApiTypes.WageUnit expectedWageUnit, decimal?lowerBound, decimal?upperBound, string expectedWageText)
        {
            const int weeklyWage          = 2550;
            const int vacancyReference    = 1234;
            const int liveVacancyStatusId = 2;

            var provideSettings = new Mock <IProvideSettings>();
            var sut             = new Register.Api.Mappings.ApprenticeshipMapper(provideSettings.Object);

            var apprenticeshipVacancy = new Fixture().Build <ApprenticeshipVacancy>()
                                        .With(v => v.VacancyReferenceNumber, vacancyReference)
                                        .With(v => v.ApprenticeshipTypeId, 1)
                                        .With(v => v.VacancyStatusId, liveVacancyStatusId)
                                        .With(v => v.WageLowerBound, lowerBound)
                                        .With(v => v.WageUpperBound, upperBound)
                                        .With(v => v.WageType, (int)LegacyWageType.CustomRange)
                                        .With(v => v.WeeklyWage, weeklyWage)
                                        .Without(v => v.WageText)
                                        .With(v => v.WageUnitId, wageUnitId)
                                        .Create();

            var vacancy = sut.MapToApprenticeshipVacancy(apprenticeshipVacancy);

            vacancy.VacancyReference.Should().Be(vacancyReference);
            vacancy.WageUnit.Should().Be(expectedWageUnit);
            vacancy.WageText.Should().Be(expectedWageText);
        }
Пример #3
0
        public void ShouldHaveWageSetForVacancy()
        {
            const decimal minApprenticeshipWageRate = 4.05m;
            const decimal hoursPerWeek = 30;

            var apprenticeshipVacancy = new Fixture().Build <ApprenticeshipVacancy>()
                                        .With(v => v.VacancyReferenceNumber, VacancyReference)
                                        .With(v => v.ApprenticeshipTypeId, 1)
                                        .With(v => v.VacancyStatusId, LiveVacancyStatusId)
                                        .With(v => v.WageType, (int)LegacyWageType.ApprenticeshipMinimum)
                                        .With(v => v.MinimumWageRate, minApprenticeshipWageRate)
                                        .With(v => v.HoursPerWeek, hoursPerWeek)
                                        .Without(v => v.WageUnitId)
                                        .Create();

            var vacancy = _sut.MapToApprenticeshipVacancy(apprenticeshipVacancy);

            vacancy.VacancyReference.Should().Be(VacancyReference);
            vacancy.WageUnit.Should().Be(ApiTypes.WageUnit.Unspecified);
            vacancy.WageText.Should().Be("£121.50");
        }
Пример #4
0
        public void ShouldHaveWageSetForVacancy(decimal?lowerBound, decimal?upperBound, string expectedWageText)
        {
            var           minNationalWageLowerBound = lowerBound;
            var           minNationalWageUpperBound = upperBound;
            const decimal hoursPerWeek = 30;

            var apprenticeshipVacancy = new Fixture().Build <ApprenticeshipVacancy>()
                                        .With(v => v.VacancyReferenceNumber, VacancyReference)
                                        .With(v => v.ApprenticeshipTypeId, 1)
                                        .With(v => v.VacancyStatusId, LiveVacancyStatusId)
                                        .With(v => v.WageType, (int)LegacyWageType.NationalMinimum)
                                        .With(v => v.MinimumWageLowerBound, minNationalWageLowerBound)
                                        .With(v => v.MinimumWageUpperBound, minNationalWageUpperBound)
                                        .With(v => v.HoursPerWeek, hoursPerWeek)
                                        .Without(v => v.WageUnitId)
                                        .Create();

            var vacancy = _sut.MapToApprenticeshipVacancy(apprenticeshipVacancy);

            vacancy.VacancyReference.Should().Be(VacancyReference);
            vacancy.WageUnit.Should().Be(ApiTypes.WageUnit.Unspecified);
            vacancy.WageText.Should().Be(expectedWageText);
        }
        public void ShouldHaveAppropriateWageDescription(LegacyWageType legacyWageType, string expectedWageText)
        {
            const int vacancyReference    = 1234;
            const int liveVacancyStatusId = 2;

            var provideSettings = new Mock <IProvideSettings>();
            var sut             = new Register.Api.Mappings.ApprenticeshipMapper(provideSettings.Object);

            var apprenticeshipVacancy = new Fixture().Build <ApprenticeshipVacancy>()
                                        .With(v => v.VacancyReferenceNumber, vacancyReference)
                                        .With(v => v.ApprenticeshipTypeId, 1)
                                        .With(v => v.VacancyStatusId, liveVacancyStatusId)
                                        .With(v => v.WageType, (int)legacyWageType)
                                        .Without(v => v.WeeklyWage)
                                        .Without(v => v.WageUnitId)
                                        .Create();

            var vacancy = sut.MapToApprenticeshipVacancy(apprenticeshipVacancy);

            vacancy.VacancyReference.Should().Be(vacancyReference);
            vacancy.WageUnit.Should().Be(ApiTypes.WageUnit.Unspecified);
            vacancy.WageText.Should().Be(expectedWageText);
        }
        public void ShouldHaveUnknownWageForVacanciesWithLegacyTextWageType()
        {
            const int    vacancyReference    = 1234;
            const int    liveVacancyStatusId = 2;
            const string unknownwWageText    = "Unknown";

            var provideSettings = new Mock <IProvideSettings>();
            var sut             = new Register.Api.Mappings.ApprenticeshipMapper(provideSettings.Object);

            var apprenticeshipVacancy = new Fixture().Build <ApprenticeshipVacancy>()
                                        .With(v => v.VacancyReferenceNumber, vacancyReference)
                                        .With(v => v.ApprenticeshipTypeId, 1)
                                        .With(v => v.VacancyStatusId, liveVacancyStatusId)
                                        .With(v => v.WageType, (int)LegacyWageType.LegacyText)
                                        .Without(v => v.WageUnitId)
                                        .Create();

            var vacancy = sut.MapToApprenticeshipVacancy(apprenticeshipVacancy);

            vacancy.VacancyReference.Should().Be(vacancyReference);
            vacancy.WageUnit.Should().Be(ApiTypes.WageUnit.Unspecified);
            vacancy.WageText.Should().Be(unknownwWageText);
        }