public VacancyOwnerRelationship GetVacancyOwnerRelationship(int providerSiteId, string edsUrn)
        {
            Condition.Requires(providerSiteId);
            Condition.Requires(edsUrn).IsNotNullOrEmpty();

            _logService.Debug("Calling Employer Service to get employer with EDSURN='{0}'.", edsUrn);

            var employer = _employerService.GetEmployer(edsUrn);

            _logService.Debug(
                "Calling VacancyOwnerRelationshipReadRepository to get vacancy party for provider site with Id='{0}' and employer with Id='{1}'.",
                providerSiteId, employer.EmployerId);

            var vacancyOwnerRelationship =
                _vacancyOwnerRelationshipReadRepository.GetByProviderSiteAndEmployerId(providerSiteId, employer.EmployerId) ??
                new VacancyOwnerRelationship {
                ProviderSiteId = providerSiteId, EmployerId = employer.EmployerId
            };

            return(vacancyOwnerRelationship);
        }
Exemplo n.º 2
0
        public void ShouldGetByProviderSiteAndEmployerId()
        {
            // Act.
            var providerSiteId = SeedData.ProviderSites.HopwoodCampus.ProviderSiteId;
            var employerId     = SeedData.Employers.AcmeCorp.EmployerId;

            var vacancyOwnerRelationshipByProviderSiteAndEmployerId = _vacancyOwnerRelationshipReadRepository.GetByProviderSiteAndEmployerId(providerSiteId, employerId);

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

            // Act.
            var vacancyOwnerRelationshipById = _vacancyOwnerRelationshipReadRepository.GetByIds(new[] { vacancyOwnerRelationshipByProviderSiteAndEmployerId.VacancyOwnerRelationshipId }).FirstOrDefault();

            // Assert.
            vacancyOwnerRelationshipById.Should().NotBeNull();
        }