public void FromRepository()
        {
            var service = new ProviderServiceBuilder().With(_employerService.Object).With(_vacancyOwnerRelationshipReadRepository.Object).Build();

            var linksPage = service.GetVacancyOwnerRelationships(_employerSearchRequest, CurrentPage, PageSize);

            linksPage.Should().NotBeNull();
            linksPage.Page.Count().Should().Be(_fromRepository.Count);
            linksPage.Page.ShouldBeEquivalentTo(_fromRepository);
            linksPage.ResultsCount.Should().Be(_fromRepository.Count);
            linksPage.TotalNumberOfPages.Should().Be(1);
        }
예제 #2
0
        public void FromRepository()
        {
            var repository = new Mock <IProviderReadRepository>();

            repository.Setup(r => r.GetByUkprn(Ukprn, true)).Returns(_provider1);
            var service = new ProviderServiceBuilder().With(repository.Object).Build();

            var provider = service.GetProvider(Ukprn);

            provider.Should().NotBeNull();
            provider.Should().Be(_provider1);
        }
        public void NameAndLocationRepositorySearch(string addressLine4, string town)
        {
            // Arrange.
            var fromRepository = new List <VacancyOwnerRelationship>
            {
                _providerSiteEmployerLink1,
                _providerSiteEmployerLink2,
                _providerSiteEmployerLink3
            };

            _vacancyOwnerRelationshipReadRepository.Setup(r => r.
                                                          GetByProviderSiteId(ProviderSiteId))
            .Returns(fromRepository);

            var service = new ProviderServiceBuilder()
                          .With(_employerService.Object)
                          .With(_vacancyOwnerRelationshipReadRepository.Object)
                          .Build();

            _employer1.Address.AddressLine4 = addressLine4;
            _employer1.Address.Town         = town;

            var employerName = _employer1.FullName.Substring(0, 10);
            var location     = (addressLine4 ?? town).Substring(0, 15);

            var employerSearchRequest = new EmployerSearchRequest(
                ProviderSiteId, employerName, location);

            var expectedResults = new List <VacancyOwnerRelationship>
            {
                _providerSiteEmployerLink1
            };

            // Act.
            var linksPage = service.GetVacancyOwnerRelationships(employerSearchRequest, CurrentPage, PageSize);

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

            linksPage.Page.Count().Should().Be(expectedResults.Count);
            linksPage.Page.ShouldBeEquivalentTo(expectedResults);

            linksPage.ResultsCount.Should().Be(expectedResults.Count);
            linksPage.TotalNumberOfPages.Should().Be(1);
        }
        public void PostCodeRepositorySearch()
        {
            var fromRepository = new List <VacancyOwnerRelationship> {
                _providerSiteEmployerLink1, _providerSiteEmployerLink2, _providerSiteEmployerLink3
            };

            _vacancyOwnerRelationshipReadRepository.Setup(r => r.GetByProviderSiteId(ProviderSiteId)).Returns(fromRepository);
            var service = new ProviderServiceBuilder().With(_employerService.Object).With(_vacancyOwnerRelationshipReadRepository.Object).Build();
            var employerSearchRequest = new EmployerSearchRequest(ProviderSiteId, null, _employer3.Address.Postcode.Substring(0, 10));

            var linksPage = service.GetVacancyOwnerRelationships(employerSearchRequest, CurrentPage, PageSize);

            var expectedResults = new List <VacancyOwnerRelationship> {
                _providerSiteEmployerLink3
            };

            linksPage.Should().NotBeNull();
            linksPage.Page.Count().Should().Be(expectedResults.Count);
            linksPage.Page.ShouldBeEquivalentTo(expectedResults);
            linksPage.ResultsCount.Should().Be(expectedResults.Count);
            linksPage.TotalNumberOfPages.Should().Be(1);
        }