コード例 #1
0
        public void ShouldMapVacancyLocationTypeNational()
        {
            // Arrange.
            var src = new GatewayServiceProxy.VacancySummary
            {
                VacancyType         = "IntermediateLevelApprenticeship",
                VacancyLocationType = "National"
            };

            // Act.
            var dest = new LegacyVacancySummaryMapper().Map <GatewayServiceProxy.VacancySummary, ApprenticeshipSummary>(src);

            // Assert.
            dest.Should().NotBeNull();
            dest.VacancyLocationType.Should().Be(ApprenticeshipLocationType.National);
        }
コード例 #2
0
        public void ShouldMapNullVacancyReference()
        {
            // Arrange.
            var src = new GatewayServiceProxy.VacancySummary
            {
                VacancyReference    = null,
                VacancyType         = "IntermediateLevelApprenticeship",
                VacancyLocationType = "MultipleLocation",
            };

            // Act.
            var dest = new LegacyVacancySummaryMapper().Map <GatewayServiceProxy.VacancySummary, ApprenticeshipSummary>(src);

            // Assert.
            dest.Should().NotBeNull();
            dest.VacancyReference.Should().BeNull();
        }
コード例 #3
0
        public void ShouldMapNullAddress()
        {
            // Arrange.
            var src = new GatewayServiceProxy.VacancySummary
            {
                VacancyType         = "IntermediateLevelApprenticeship",
                VacancyLocationType = "MultipleLocation",
                Address             = null
            };

            // Act.
            var dest = new LegacyVacancySummaryMapper().Map <GatewayServiceProxy.VacancySummary, ApprenticeshipSummary>(src);

            // Assert.
            dest.Should().NotBeNull();
            dest.Location.Latitude.Should().Be(0.0);
            dest.Location.Longitude.Should().Be(0.0);
        }
コード例 #4
0
        public void ShouldMapVacancyLocationWhenSpecified()
        {
            // Arrange.
            var src = new GatewayServiceProxy.VacancySummary
            {
                VacancyType         = "IntermediateLevelApprenticeship",
                VacancyLocationType = "Standard",
                Address             = new GatewayServiceProxy.VacancySummaryAddress
                {
                    Latitude  = 1.0m,
                    Longitude = 2.0m
                }
            };

            // Act.
            var dest = new LegacyVacancySummaryMapper().Map <GatewayServiceProxy.VacancySummary, ApprenticeshipSummary>(src);

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

            dest.Location.Latitude.Should().Be(1.0);
            dest.Location.Longitude.Should().Be(2.0);
        }
コード例 #5
0
        public void ShouldMapAllOneToOneFields()
        {
            // Arrange.
            var src = new GatewayServiceProxy.VacancySummary
            {
                VacancyId           = 42,
                VacancyType         = "IntermediateLevelApprenticeship",
                VacancyLocationType = "Standard",
                ClosingDate         = DateTime.Today.AddDays(1),
                EmployerName        = "EmployerName",
                VacancyTitle        = "VacancyTitle",
            };

            // Act.
            var dest = new LegacyVacancySummaryMapper().Map <GatewayServiceProxy.VacancySummary, ApprenticeshipSummary>(src);

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

            dest.Id.Should().Be(src.VacancyId);
            dest.ClosingDate.Should().Be(src.ClosingDate ?? DateTime.Now);
            dest.EmployerName.Should().Be(src.EmployerName);
            dest.Title.Should().Be(src.VacancyTitle);
        }