コード例 #1
0
        public void AndEmployerIsNotAnonymous_ThenDoNotReplaceEmployerNameAndDescription()
        {
            var vacancy = new Fixture().Build <Domain.Entities.ApprenticeshipVacancy>()
                          .With(v => v.ApprenticeshipTypeId, 1)
                          .With(v => v.WageUnitId, null)
                          .With(v => v.VacancyReferenceNumber, 1234)
                          .With(v => v.VacancyStatusId, 2)
                          .With(v => v.EmployerName, "ABC Ltd")
                          .With(v => v.EmployerDescription, "A plain company")
                          .With(v => v.EmployerWebsite, "http://www.google.co.uk")
                          .Without(v => v.AnonymousEmployerName)
                          .Without(v => v.AnonymousEmployerDescription)
                          .Without(v => v.AnonymousEmployerReason)
                          .Create();

            var result = _sut.MapToApprenticeshipVacancy(vacancy);

            result.VacancyReference.Should().Be(vacancy.VacancyReferenceNumber);
            result.EmployerName.Should().Be("ABC Ltd");
            result.EmployerDescription.Should().Be("A plain company");
            result.EmployerWebsite.Should().Be("http://www.google.co.uk");
            result.Location.Should().NotBeNull();
            result.Location.AddressLine1.Should().NotBeNull();
            result.Location.AddressLine2.Should().NotBeNull();
            result.Location.AddressLine3.Should().NotBeNull();
            result.Location.AddressLine4.Should().NotBeNull();
            result.Location.AddressLine5.Should().NotBeNull();
            result.Location.Town.Should().NotBeNull();
            result.Location.PostCode.Should().NotBeNull();
            result.Location.GeoPoint.Should().NotBeNull();
            result.Location.GeoPoint.Longitude.Should().NotBeNull();
            result.Location.GeoPoint.Latitude.Should().NotBeNull();
        }
コード例 #2
0
        public void ShouldThrowErrorForUnknownWageUnitId()
        {
            var apprenticeshipVacancy = new Fixture().Build <ApprenticeshipVacancy>()
                                        .With(v => v.WageType, (int)LegacyWageType.Custom)
                                        .With(v => v.WageUnitId, 99)
                                        .Create();

            Assert.Throws <InvalidEnumArgumentException>(() => _sut.MapToApprenticeshipVacancy(apprenticeshipVacancy));
        }
        public void MapApprenticeshipTypeValid(int apprenticeshipTypeId, string educationLevel)
        {
            var vacancy = new ApprenticeshipVacancy
            {
                ApprenticeshipTypeId = apprenticeshipTypeId,
                Location             = new Address()
            };

            var result = _sut.MapToApprenticeshipVacancy(vacancy);

            result.ApprenticeshipLevel.Should().Be(educationLevel);
        }
        public void ShouldMapUsingLocationTypeId(int vacancyLocationTypeid, bool expectedResult)
        {
            var vacancy = new ApprenticeshipVacancy()
            {
                VacancyLocationTypeId = vacancyLocationTypeid,
                Location             = new Address(),
                ApprenticeshipTypeId = 1
            };

            var result = _sut.MapToApprenticeshipVacancy(vacancy);

            result.IsNationwide.Should().Be(expectedResult);
        }
コード例 #5
0
        public void ThenSetApplicationUrl()
        {
            string expectedUrl = "https://" + Guid.NewGuid();
            var    vacancy     = new ApprenticeshipVacancy
            {
                EmployersRecruitmentWebsite = expectedUrl,
                Location             = new Address(),
                ApprenticeshipTypeId = 1
            };

            ApprenticeshipVacancyDto result = _sut.MapToApprenticeshipVacancy(vacancy);

            result.ApplicationUrl.Should().Be(expectedUrl);
        }
コード例 #6
0
        public void ThenSetApplicationInstructions()
        {
            string expectedInstructions = Guid.NewGuid().ToString();
            var    vacancy = new ApprenticeshipVacancy
            {
                EmployersApplicationInstructions = expectedInstructions,
                Location             = new Address(),
                ApprenticeshipTypeId = 1
            };

            ApprenticeshipVacancyDto result = _sut.MapToApprenticeshipVacancy(vacancy);

            result.ApplicationInstructions.Should().Be(expectedInstructions);
        }
コード例 #7
0
        public void WithFrameworkOrStandardIsMissingThenReturnUnavailable()
        {
            var vacancy = new Fixture().Build <ApprenticeshipVacancy>()
                          .With(v => v.ApprenticeshipTypeId, 1)
                          .With(v => v.WageUnitId, null)
                          .Without(v => v.Framework)
                          .Without(v => v.Standard)
                          .Create();

            var sut = new ApprenticeshipMapper(Mock.Of <IProvideSettings>());

            var result = sut.MapToApprenticeshipVacancy(vacancy);

            Assert.AreEqual(ApiTypes.TrainingType.Unavailable, result.TrainingType);
        }
コード例 #8
0
        public void WithStandardThenLoadStandardDetails()
        {
            var vacancy = new Fixture().Build <ApprenticeshipVacancy>()
                          .With(v => v.WageUnitId, null)
                          .With(v => v.ApprenticeshipTypeId, 1)
                          .Without(v => v.Framework)
                          .With(v => v.Standard, new Standard
            {
                Title = "Title",
                Code  = 13,
                Uri   = "sdfe"
            })
                          .Create();

            var sut = new ApprenticeshipMapper(Mock.Of <IProvideSettings>());

            var result = sut.MapToApprenticeshipVacancy(vacancy);

            Assert.AreEqual(ApiTypes.TrainingType.Standard, result.TrainingType);
        }
コード例 #9
0
        public void ShouldPopulateVacancyUrl()
        {
            //Arrange
            var provideSettings = new Mock <IProvideSettings>();
            var baseUrl         = "https://findapprentice.com/apprenticeship/reference";

            provideSettings
            .Setup(p => p.GetSetting(ApplicationSettingKeys.LiveApprenticeshipVacancyBaseUrlKey))
            .Returns(baseUrl);

            var sut = new ApprenticeshipMapper(provideSettings.Object);

            var vacancy = new Fixture().Build <Domain.Entities.ApprenticeshipVacancy>()
                          .With(v => v.WageUnitId, null)
                          .With(v => v.ApprenticeshipTypeId, 1)
                          .Create();

            //Act
            var result = sut.MapToApprenticeshipVacancy(vacancy);

            //Assert
            Assert.AreEqual($"{baseUrl}/{vacancy.VacancyReferenceNumber}", result.VacancyUrl);
        }