예제 #1
0
        public void DoesDatabaseVacancyObjectToDomainObjectMapperChokeInPractice()
        {
            // Arrange
            var mapper  = new ApprenticeshipVacancyMappers();
            var vacancy = CreateValidDatabaseVacancy();

            // Act / Assert no exception
            mapper.Map <Vacancy, ApprenticeshipVacancy>(vacancy);
        }
예제 #2
0
        public void DoMappersMapEverything()
        {
            // Arrange
            var x = new ApprenticeshipVacancyMappers();

            // Act
            x.Initialise();

            // Assert
            x.Mapper.AssertConfigurationIsValid();
        }
예제 #3
0
        public void DoesDatabaseVacancyObjectMappingRoundTripViaDomainObjectIncludingHardOnes()
        {
            // Arrange
            var mapper         = new ApprenticeshipVacancyMappers();
            var domainVacancy1 = new Fixture().Create <ApprenticeshipVacancy>();

            // Act

            var databaseVacancy = mapper.Map <ApprenticeshipVacancy, Vacancy>(domainVacancy1);
            var domainVacancy2  = mapper.Map <Vacancy, ApprenticeshipVacancy>(databaseVacancy);

            // Assert
            domainVacancy2.ShouldBeEquivalentTo(domainVacancy1);
        }
예제 #4
0
        public void DoesApprenticeshipVacancyDomainObjectMappingRoundTripViaDatabaseObjectExcludingHardOnes()
        {
            // Arrange
            var mapper           = new ApprenticeshipVacancyMappers();
            var databaseVacancy1 = CreateValidDatabaseVacancy();

            // Act

            var domainVacancy    = mapper.Map <Vacancy, ApprenticeshipVacancy>(databaseVacancy1);
            var databaseVacancy2 = mapper.Map <ApprenticeshipVacancy, Vacancy>(domainVacancy);

            // Assert
            databaseVacancy2.ShouldBeEquivalentTo(databaseVacancy1, options =>
                                                  ExcludeHardOnes(options));
        }
예제 #5
0
        public void DoesDatabaseVacancyObjectMappingRoundTripViaDomainObjectExcludingHardOnes()
        {
            // Arrange
            var mapper         = new ApprenticeshipVacancyMappers();
            var domainVacancy1 = new Fixture().Create <ApprenticeshipVacancy>();

            // Act

            var databaseVacancy = mapper.Map <ApprenticeshipVacancy, Vacancy>(domainVacancy1);
            var domainVacancy2  = mapper.Map <Vacancy, ApprenticeshipVacancy>(databaseVacancy);

            // Assert
            domainVacancy2.ShouldBeEquivalentTo(domainVacancy1, options =>
                                                ExcludeHardOnes(options)
                                                .Excluding(x => x.LocationAddresses)); // Manually mapped
        }
예제 #6
0
        public void DoesApprenticeshipVacancyDomainObjectToDatabaseObjectMapperChokeInPractice()
        {
            // Arrange
            var x = new ApprenticeshipVacancyMappers();

            var vacancy =
                new Fixture().Build <ApprenticeshipVacancy>()
                //                    .With(av => av.EntityId, Guid.Empty)
                .With(av => av.Status, ProviderVacancyStatuses.PendingQA)
                .With(av => av.QAUserName, null)
                .With(av => av.DateStartedToQA, null)
                .Create();


            // Act / Assert no exception
            x.Map <ApprenticeshipVacancy, Vacancy>(vacancy);
        }