Esempio n. 1
0
        public void ShouldHandleEmployerNameAnonymisation(
            string anonymousEmployerName, bool anonymised)
        {
            // Arrange.
            var fixture = new Fixture();

            var vacancy = fixture
                          .Build <Domain.Entities.Raa.Vacancies.Vacancy>()
                          .With(each => each.EmployerAnonymousName, anonymousEmployerName)
                          .Create();

            var employer     = fixture.Create <Domain.Entities.Raa.Parties.Employer>();
            var provider     = fixture.Create <Domain.Entities.Raa.Parties.Provider>();
            var providerSite = fixture.Create <Domain.Entities.Raa.Parties.ProviderSite>();

            var categories = fixture
                             .Build <Domain.Entities.ReferenceData.Category>()
                             .CreateMany(1)
                             .ToList();

            // Act.
            var detail = TraineeshipVacancyDetailMapper.GetTraineeshipVacancyDetail(
                vacancy, employer, provider, providerSite, categories, _mockLogService.Object);

            // Assert.
            detail.Should().NotBeNull();
            detail.AnonymousEmployerName.Should().Be(anonymousEmployerName);
            detail.IsEmployerAnonymous.Should().Be(anonymised);
        }
Esempio n. 2
0
        public void ShouldMapContactDetailsFromVacancyForVacanciesEditedInRaa()
        {
            // Arrange.
            var fixture = new Fixture();

            var vacancy = fixture
                          .Build <Domain.Entities.Raa.Vacancies.Vacancy>()
                          .With(each => each.EditedInRaa, true)
                          .Create();

            var employer     = fixture.Create <Domain.Entities.Raa.Parties.Employer>();
            var provider     = fixture.Create <Domain.Entities.Raa.Parties.Provider>();
            var providerSite = fixture.Create <Domain.Entities.Raa.Parties.ProviderSite>();

            var categories = fixture
                             .Build <Domain.Entities.ReferenceData.Category>()
                             .CreateMany(1)
                             .ToList();

            var expectedContact = vacancy.ContactName + " " + vacancy.ContactNumber + " " + vacancy.ContactEmail;

            // Act.
            var detail = TraineeshipVacancyDetailMapper.GetTraineeshipVacancyDetail(
                vacancy, employer, provider, providerSite, categories, _mockLogService.Object);

            // Assert.
            detail.Contact.Should().NotBe(providerSite.ContactDetailsForCandidate);
            detail.Contact.Should().Be(expectedContact);
        }
Esempio n. 3
0
        public TraineeshipVacancyDetail GetVacancyDetails(int vacancyId, bool errorIfNotFound = false)
        {
            var vacancy = _vacancyReadRepository.Get(vacancyId);

            if (vacancy == null)
            {
                if (errorIfNotFound)
                {
                    throw new DomainException(ErrorCodes.VacancyNotFoundError, new { vacancyId });
                }
                return(null);
            }

            var vacancyOwnerRelationship = _providerService.GetVacancyOwnerRelationship(vacancy.VacancyOwnerRelationshipId, false); // Some current vacancies have non-current vacancy parties
            var employer = _employerService.GetEmployer(vacancyOwnerRelationship.EmployerId, false);

            var providerSite = _providerService.GetProviderSite(vacancyOwnerRelationship.ProviderSiteId);

            if (providerSite == null)
            {
                throw new System.Exception($"Could not find VacancyOwnerRelationship for ProviderSiteId={vacancyOwnerRelationship.ProviderSiteId}");
            }

            var provider   = _providerService.GetProvider(vacancy.ContractOwnerId);
            var categories = _referenceDataProvider.GetCategories();

            return(TraineeshipVacancyDetailMapper.GetTraineeshipVacancyDetail(vacancy, employer, provider, providerSite, categories, _logService));
        }
Esempio n. 4
0
        public void ShouldGetTraineeshipDetail(int vacancyCount, int categoryCount)
        {
            for (var i = 0; i < vacancyCount; i++)
            {
                // Arrange.
                var fixture = new Fixture();

                var vacancy = fixture
                              .Build <Domain.Entities.Raa.Vacancies.Vacancy>()
                              .With(each => each.Wage, new Wage(WageType.NationalMinimum, 0, null, null, string.Empty, WageUnit.NotApplicable, 0, null))
                              .Create();

                var employer     = fixture.Create <Domain.Entities.Raa.Parties.Employer>();
                var provider     = fixture.Create <Domain.Entities.Raa.Parties.Provider>();
                var providerSite = fixture.Create <Domain.Entities.Raa.Parties.ProviderSite>();

                var categories = fixture
                                 .Build <Domain.Entities.ReferenceData.Category>()
                                 .CreateMany(categoryCount)
                                 .ToList();

                // Act.
                var detail = TraineeshipVacancyDetailMapper.GetTraineeshipVacancyDetail(
                    vacancy, employer, provider, providerSite, categories, _mockLogService.Object);

                // Assert.
                detail.Should().NotBeNull();

                detail.Id.Should().Be(vacancy.VacancyId);
                detail.VacancyReference.Should().Be(vacancy.VacancyReferenceNumber.GetVacancyReference());
                detail.Title.Should().Be(vacancy.Title);
                detail.Description.Should().Be(vacancy.ShortDescription);
                detail.FullDescription.Should().Be(vacancy.LongDescription);

                detail.SubCategory.Should().BeNull();

                detail.StartDate.Should().Be(vacancy.PossibleStartDate ?? DateTime.MinValue);
                detail.ClosingDate.Should().Be(vacancy.ClosingDate ?? DateTime.MinValue);
                detail.PostedDate.Should().Be(vacancy.DateQAApproved ?? DateTime.MinValue);
                detail.InterviewFromDate.Should().Be(DateTime.MinValue);

                // NOTE: hard to unit test.
                detail.Wage.Should().Be(vacancy.Wage);
                detail.Wage.Unit.Should().Be(WageUnit.Weekly);
                detail.Wage.Type.Should().Be(vacancy.Wage.Type);
                detail.Wage.ReasonForType.Should().Be(vacancy.Wage.ReasonForType);

                detail.WorkingWeek.Should().Be(vacancy.WorkingWeek);

                detail.OtherInformation.Should().Be(vacancy.OtherInformation);
                detail.FutureProspects.Should().Be(vacancy.FutureProspects);
                detail.VacancyOwner.Should().BeNull();
                detail.VacancyManager.Should().BeNull();

                detail.LocalAuthority.Should().BeNull();
                detail.NumberOfPositions.Should().Be(vacancy.NumberOfPositions ?? 0);
                detail.RealityCheck.Should().Be(vacancy.ThingsToConsider);
                detail.Created.Should().Be(vacancy.CreatedDateTime);
                detail.VacancyStatus.Should().Be(vacancy.Status.GetVacancyStatuses());
                detail.TrainingType.Should().Be(vacancy.TrainingType.GetTrainingType());
                detail.EmployerName.Should().BeOneOf(employer.FullName, vacancy.EmployerAnonymousName);
                detail.AnonymousEmployerName.Should().Be(vacancy.EmployerAnonymousName);
                detail.EmployerDescription.Should().BeOneOf(vacancy.EmployerDescription, vacancy.AnonymousAboutTheEmployer);
                detail.EmployerWebsite.Should().Be(vacancy.EmployerWebsiteUrl);
                detail.ApplyViaEmployerWebsite.Should().Be(vacancy.OfflineVacancy ?? false);
                detail.VacancyUrl.Should().Be(vacancy.OfflineApplicationUrl);
                detail.ApplicationInstructions.Should().Be(vacancy.OfflineApplicationInstructions);
                detail.IsEmployerAnonymous.Should().Be(!string.IsNullOrWhiteSpace(vacancy.EmployerAnonymousName));
                detail.IsPositiveAboutDisability.Should().Be(employer.IsPositiveAboutDisability);

                detail.ExpectedDuration.Should().Be(vacancy.ExpectedDuration);

                detail.VacancyAddress.Should().NotBeNull();

                detail.VacancyAddress.AddressLine1.Should().Be(vacancy.Address.AddressLine1);
                detail.VacancyAddress.AddressLine2.Should().Be(vacancy.Address.AddressLine2);
                detail.VacancyAddress.AddressLine3.Should().Be(vacancy.Address.AddressLine3);
                detail.VacancyAddress.AddressLine4.Should().Be(vacancy.Address.AddressLine4);
                detail.VacancyAddress.Postcode.Should().Be(vacancy.Address.Postcode);

                // NOTE: hard to unit test.
                detail.VacancyAddress.GeoPoint.Should().NotBeNull();
                detail.VacancyAddress.GeoPoint.Latitude.Should().NotBe(0.0);
                detail.VacancyAddress.GeoPoint.Longitude.Should().NotBe(0.0);

                detail.IsRecruitmentAgencyAnonymous.Should().Be(false);
                detail.IsSmallEmployerWageIncentive.Should().Be(false);

                detail.SupplementaryQuestion1.Should().Be(vacancy.FirstQuestion);
                detail.SupplementaryQuestion2.Should().Be(vacancy.SecondQuestion);

                detail.RecruitmentAgency.Should().Be(providerSite.TradingName);
                detail.ProviderName.Should().Be(provider.TradingName);
                detail.TradingName.Should().Be(employer.TradingName);
                detail.ProviderDescription.Should().BeNull();

                // NOTE: hard to unit test.
                detail.Contact.Should().NotBeNull();

                detail.ProviderSectorPassRate.Should().Be(default(int?));
                detail.TrainingToBeProvided.Should().Be(vacancy.TrainingProvided);
                detail.ContractOwner.Should().BeNull();
                detail.DeliveryOrganisation.Should().BeNull();
                detail.IsNasProvider.Should().Be(false);
                detail.PersonalQualities.Should().Be(vacancy.PersonalQualities);
                detail.QualificationRequired.Should().Be(vacancy.DesiredQualifications);
                detail.SkillsRequired.Should().Be(vacancy.DesiredSkills);

                detail.AdditionalLocationInformation.Should().Be(vacancy.AdditionalLocationInformation);
            }
        }