public void Setup()
 {
     _apprenticeshipSearchService = new Mock <IVacancySearchService <ApprenticeshipSearchResponse, ApprenticeshipVacancyDetail, ApprenticeshipSearchParameters> >();
     _candidateService            = new Mock <ICandidateService>();
     _apprenticeshipMapper        = new ApprenticeshipCandidateWebMappers();
     _logService = new Mock <ILogService>();
     _candidateVacancyService = new Mock <ICandidateVacancyService>();
 }
Ejemplo n.º 2
0
        public void Setup()
        {
            _logService                  = new Mock <ILogService>();
            _locationSearchService       = new Mock <ILocationSearchService>();
            _apprenticeshipSearchService = new Mock <IVacancySearchService <ApprenticeshipSearchResponse, ApprenticeshipVacancyDetail, ApprenticeshipSearchParameters> >();
            _traineeshipSearchService    = new Mock <IVacancySearchService <TraineeshipSearchResponse, TraineeshipVacancyDetail, TraineeshipSearchParameters> >();
            _addressSearchService        = new Mock <IAddressSearchService>();

            _apprenticeshipMapper = new ApprenticeshipCandidateWebMappers();
            _traineeeshipMapper   = new TraineeshipCandidateWebMappers();
        }
Ejemplo n.º 3
0
        public void MonitoringInformationViewModelShouldNotFailWhenDisablilityOrGenderAreNull()
        {
            var mapper = new ApprenticeshipCandidateWebMappers();
            var monitoringInformationViewModel = new MonitoringInformationViewModel();
            var monitoringInformation          = mapper.Map <MonitoringInformationViewModel, MonitoringInformation>(monitoringInformationViewModel);

            monitoringInformation.Should().NotBeNull();
            monitoringInformation.DisabilityStatus.Should().BeNull();
            monitoringInformation.Gender.Should().BeNull();
            monitoringInformation.Ethnicity.Should().Be(null);
        }
        public void ShouldTryParseWageDescriptionIfWageTypeIsText()
        {
            var vacancyDetail = new ApprenticeshipVacancyDetail
            {
                Wage = new Wage(WageType.LegacyText, null, null, null, "123.45678", WageUnit.NotApplicable, null, null)
            };

            var model = new ApprenticeshipCandidateWebMappers().Map <ApprenticeshipVacancyDetail, ApprenticeshipVacancyDetailViewModel>(vacancyDetail);

            model.Should().NotBeNull();
            WagePresenter.GetDisplayAmount(model.Wage.Type, model.Wage.Amount, model.Wage.AmountLowerBound, model.Wage.AmountUpperBound, model.Wage.Text, model.Wage.HoursPerWeek, null).Should().Be("£123.46");
        }
        public void ShouldShowWageIfWageTypeIsWeekly()
        {
            var vacancyDetail = new ApprenticeshipVacancyDetail
            {
                Wage = new Wage(WageType.LegacyWeekly, 101.19m, null, null, null, WageUnit.NotApplicable, null, null)
            };

            var          model        = new ApprenticeshipCandidateWebMappers().Map <ApprenticeshipVacancyDetail, ApprenticeshipVacancyDetailViewModel>(vacancyDetail);
            const string expectedWage = "£101.19";

            model.Should().NotBeNull();
            WagePresenter.GetDisplayAmount(model.Wage.Type, model.Wage.Amount, model.Wage.AmountLowerBound, model.Wage.AmountUpperBound, model.Wage.Text, model.Wage.HoursPerWeek, null).Should().Be(expectedWage);
        }
        public void ShouldReturnTheVacancyUrlWithHttpsIfItStartsWithIt()
        {
            var vacancyDetail = new ApprenticeshipVacancyDetail
            {
                VacancyUrl = "https://wwww.someweb.com"
            };

            var model = new ApprenticeshipCandidateWebMappers().Map <ApprenticeshipVacancyDetail, VacancyDetailViewModel>(vacancyDetail);

            model.Should().NotBeNull();
            model.VacancyUrl.Should().StartWith("https://");
            model.IsWellFormedVacancyUrl.Should().Be(true);
        }
        public void ShouldReturnTheEmployerWebsiteWithHttpIfItAlreadyHasIt()
        {
            var vacancyDetail = new ApprenticeshipVacancyDetail
            {
                EmployerWebsite = "http://wwww.someweb.com"
            };

            var model = new ApprenticeshipCandidateWebMappers().Map <ApprenticeshipVacancyDetail, VacancyDetailViewModel>(vacancyDetail);

            model.Should().NotBeNull();
            model.EmployerWebsite.Should().StartWith("http://");
            model.IsWellFormedEmployerWebsiteUrl.Should().Be(true);
        }
        public void ShouldShowWageDescriptionIfWageTypeIsText()
        {
            var vacancyDetail = new ApprenticeshipVacancyDetail
            {
                WageType        = WageType.Text,
                WageDescription = "Competetive"
            };

            var model = new ApprenticeshipCandidateWebMappers().Map <ApprenticeshipVacancyDetail, VacancyDetailViewModel>(vacancyDetail);

            model.Should().NotBeNull();
            model.Wage.Should().Be(vacancyDetail.WageDescription);
        }
        public void ShouldNotAnonymiseEmployerNameIfEmployerHasNotOptedForAnonymity()
        {
            var vacancyDetail = new ApprenticeshipVacancyDetail
            {
                EmployerName        = "Acme Corp",
                IsEmployerAnonymous = false
            };

            var model = new ApprenticeshipCandidateWebMappers().Map <ApprenticeshipVacancyDetail, VacancyDetailViewModel>(vacancyDetail);

            model.Should().NotBeNull();
            model.EmployerName.Should().Be(vacancyDetail.EmployerName);
        }
        public void ShouldReturnRawStringIfVacancyUrlIsNotWellFormed()
        {
            var vacancyDetail = new ApprenticeshipVacancyDetail
            {
                VacancyUrl = "www.somedomain.co.uk / www.anotherdomain.co.uk"
            };

            var model = new ApprenticeshipCandidateWebMappers().Map <ApprenticeshipVacancyDetail, VacancyDetailViewModel>(vacancyDetail);

            model.Should().NotBeNull();
            model.VacancyUrl.Should().Be(vacancyDetail.VacancyUrl);
            model.IsWellFormedVacancyUrl.Should().Be(false);
        }
        public void ShouldNotAnonymiseEmployerNameIfEmployerHasNotOptedForAnonymity()
        {
            var vacancyDetail = new ApprenticeshipVacancyDetail
            {
                EmployerName        = "Acme Corp",
                IsEmployerAnonymous = false,
                Wage = new Wage(WageType.Custom, null, null, null, null, WageUnit.NotApplicable, null, null)
            };

            var model = new ApprenticeshipCandidateWebMappers().Map <ApprenticeshipVacancyDetail, ApprenticeshipVacancyDetailViewModel>(vacancyDetail);

            model.Should().NotBeNull();
            model.EmployerName.Should().Be(vacancyDetail.EmployerName);
        }
        public void ShouldReturnRawStringIfVacancyUrlIsNotWellFormed()
        {
            var vacancyDetail = new ApprenticeshipVacancyDetail
            {
                VacancyUrl = "www.somedomain.co.uk / www.anotherdomain.co.uk",
                Wage       = new Wage(WageType.Custom, null, null, null, null, WageUnit.NotApplicable, null, null)
            };

            var model = new ApprenticeshipCandidateWebMappers().Map <ApprenticeshipVacancyDetail, ApprenticeshipVacancyDetailViewModel>(vacancyDetail);

            model.Should().NotBeNull();
            model.VacancyUrl.Should().Be(vacancyDetail.VacancyUrl);
            model.IsWellFormedVacancyUrl.Should().Be(false);
        }
        public void ShouldReturnTheVacancyUrlWithHttpIfItDoesntHaveIt()
        {
            var vacancyDetail = new ApprenticeshipVacancyDetail
            {
                VacancyUrl = "wwww.someweb.com",
                Wage       = new Wage(WageType.Custom, null, null, null, null, WageUnit.NotApplicable, null, null)
            };

            var model = new ApprenticeshipCandidateWebMappers().Map <ApprenticeshipVacancyDetail, ApprenticeshipVacancyDetailViewModel>(vacancyDetail);

            model.Should().NotBeNull();
            model.VacancyUrl.Should().StartWith("http://");
            model.IsWellFormedVacancyUrl.Should().Be(true);
        }
        public void ShouldReturnTheEmployerWebsiteWithHttpsIfItStartsWithIt()
        {
            var vacancyDetail = new ApprenticeshipVacancyDetail
            {
                EmployerWebsite = "https://wwww.someweb.com",
                Wage            = new Wage(WageType.Custom, null, null, null, null, WageUnit.NotApplicable, null, null)
            };

            var model = new ApprenticeshipCandidateWebMappers().Map <ApprenticeshipVacancyDetail, ApprenticeshipVacancyDetailViewModel>(vacancyDetail);

            model.Should().NotBeNull();
            model.EmployerWebsite.Should().StartWith("https://");
            model.IsWellFormedEmployerWebsiteUrl.Should().Be(true);
        }
        public void ShouldShowWageIfWageTypeIsWeekly()
        {
            var vacancyDetail = new ApprenticeshipVacancyDetail
            {
                WageType = WageType.Weekly,
                Wage     = 101.19m
            };

            var          model        = new ApprenticeshipCandidateWebMappers().Map <ApprenticeshipVacancyDetail, VacancyDetailViewModel>(vacancyDetail);
            const string expectedWage = "£101.19";

            model.Should().NotBeNull();
            model.Wage.Should().Be(expectedWage);
        }
Ejemplo n.º 16
0
        public void MonitoringInformationViewModelShouldParseValuesAsExpected()
        {
            var mapper = new ApprenticeshipCandidateWebMappers();
            var monitoringInformationViewModel = new MonitoringInformationViewModel
            {
                AnythingWeCanDoToSupportYourInterview = "Anything?",
                RequiresSupportForInterview           = true,
                DisabilityStatus = (int?)DisabilityStatus.PreferNotToSay,
                Ethnicity        = 2,
                Gender           = (int?)Gender.PreferNotToSay
            };
            var monitoringInformation = mapper.Map <MonitoringInformationViewModel, MonitoringInformation>(monitoringInformationViewModel);

            monitoringInformation.DisabilityStatus.Should().Be(DisabilityStatus.PreferNotToSay);
            monitoringInformation.Gender.Should().Be(Gender.PreferNotToSay);
            monitoringInformation.Ethnicity.Should().Be(2);
        }
 public void Setup()
 {
     _logService            = new Mock <ILogService>();
     _locationSearchService = new Mock <ILocationSearchService>();
     _apprenticeshipMapper  = new ApprenticeshipCandidateWebMappers();
 }