Exemplo n.º 1
0
 public TransitStateMap(ICountryRepository countryRepository,
                        IEntryOrExitPointRepository pointRepository,
                        ICompetentAuthorityRepository competentAuthorityRepository)
 {
     this.countryRepository            = countryRepository;
     this.pointRepository              = pointRepository;
     this.competentAuthorityRepository = competentAuthorityRepository;
 }
Exemplo n.º 2
0
 public AddEntryOrExitPointHandler(IwsContext context,
                                   ICountryRepository countryRepository,
                                   IEntryOrExitPointRepository entryOrExitPointRepository)
 {
     this.context                    = context;
     this.countryRepository          = countryRepository;
     this.entryOrExitPointRepository = entryOrExitPointRepository;
 }
        public GetCompetentAuthoritiesAndEntryPointsByCountryIdHandlerTests()
        {
            entryOrExitPointRepository                = A.Fake <IEntryOrExitPointRepository>();
            intraCountryExportAllowedRepository       = A.Fake <IIntraCountryExportAllowedRepository>();
            unitedKingdomCompetentAuthorityRepository = A.Fake <IUnitedKingdomCompetentAuthorityRepository>();
            var iwsContext = new TestIwsContext();

            var countryWithData      = CountryFactory.Create(countryWithDataId);
            var unitedKingdomCountry = CountryFactory.Create(unitedKingdomCountryId);
            var countryWithNoData    = CountryFactory.Create(countryWithNoDataId);

            competentAuthorities = new[]
            {
                CompetentAuthorityFactory.Create(new Guid("67D2B3B5-298A-4BB5-901C-0C0C80097242"), unitedKingdomCountry),
                CompetentAuthorityFactory.Create(new Guid("5E7CA40F-D7B5-49C3-8850-694D36D52C94"), countryWithData),
                CompetentAuthorityFactory.Create(new Guid("DFD98B0D-F255-4BA0-96A5-527DE9F973E3"), countryWithData)
            };

            A.CallTo(() => unitedKingdomCompetentAuthorityRepository.GetAll()).Returns(new[]
            {
                new TestableUnitedKingdomCompetentAuthority(1, competentAuthorities[0], "something", null)
            });

            var competentAuthorityMapper = new CompetentAuthorityMap();
            var entryOrExitPointMapper   = new EntryOrExitPointMap();

            A.CallTo(() => entryOrExitPointRepository.GetForCountry(countryWithDataId)).Returns(new[]
            {
                EntryOrExitPointFactory.Create(new Guid("FC012C3E-4252-4D62-A8A2-D46DE0FA93B9"), countryWithData),
                EntryOrExitPointFactory.Create(new Guid("9699CC16-6EF1-4889-9598-F4B0511A2038"), countryWithData)
            });

            A.CallTo(() => intraCountryExportAllowedRepository.GetImportCompetentAuthorities(UKCompetentAuthority.England)).Returns(new[]
            {
                new TestableIntraCountryExportAllowed
                {
                    ExportCompetentAuthority   = UKCompetentAuthority.England,
                    ImportCompetentAuthorityId = competentAuthorities[1].Id
                }
            });

            repository = A.Fake <ICompetentAuthorityRepository>();

            A.CallTo(() => repository.GetCompetentAuthorities(countryWithDataId)).Returns(competentAuthorities);

            ids = new Guid[]
            {
                competentAuthorities[1].Id
            };

            A.CallTo(repository).Where(call => call.Method.Name == "GetByIds")
            .WithReturnType <CompetentAuthority[]>()
            .Returns(competentAuthorities);

            handler = new GetCompetentAuthoritiesAndEntryPointsByCountryIdHandler(entryOrExitPointMapper, competentAuthorityMapper, repository, entryOrExitPointRepository, intraCountryExportAllowedRepository, iwsContext, unitedKingdomCompetentAuthorityRepository);
        }
Exemplo n.º 4
0
 public GetCompetentAuthoritiesAndEntryOrExitPointsByCountryIdHandler(IMap <EntryOrExitPoint, EntryOrExitPointData> entryOrExitPointMapper,
                                                                      IMap <CompetentAuthority, CompetentAuthorityData> competentAuthorityMapper,
                                                                      ICompetentAuthorityRepository competentAuthorityRepository,
                                                                      IEntryOrExitPointRepository entryOrExitPointRepository)
 {
     this.entryOrExitPointRepository   = entryOrExitPointRepository;
     this.entryOrExitPointMapper       = entryOrExitPointMapper;
     this.competentAuthorityMapper     = competentAuthorityMapper;
     this.competentAuthorityRepository = competentAuthorityRepository;
 }
 public GetTransitStateDataForTransitStatesHandler(ICountryRepository countryRepository,
                                                   ICompetentAuthorityRepository competentAuthorityRepository,
                                                   IEntryOrExitPointRepository entryOrExitPointRepository,
                                                   IMapper mapper)
 {
     this.countryRepository            = countryRepository;
     this.competentAuthorityRepository = competentAuthorityRepository;
     this.entryOrExitPointRepository   = entryOrExitPointRepository;
     this.mapper = mapper;
 }
 public GetUnitedKingdomCompetentAuthoritiesAndEntryOrExitPointsHandler(ICountryRepository countryRepository,
                                                                        ICompetentAuthorityRepository competentAuthorityRepository,
                                                                        IEntryOrExitPointRepository entryOrExitPointRepository,
                                                                        IMapper mapper)
 {
     this.countryRepository            = countryRepository;
     this.competentAuthorityRepository = competentAuthorityRepository;
     this.entryOrExitPointRepository   = entryOrExitPointRepository;
     this.mapper = mapper;
 }
Exemplo n.º 7
0
 public SetExitPointHandler(ITransportRouteRepository transportRouteRepository,
                            IEntryOrExitPointRepository entryOrExitPointRepository,
                            IIntraCountryExportAllowedRepository intraCountryExportAllowedRepository,
                            IwsContext context)
 {
     this.transportRouteRepository            = transportRouteRepository;
     this.entryOrExitPointRepository          = entryOrExitPointRepository;
     this.intraCountryExportAllowedRepository = intraCountryExportAllowedRepository;
     this.context = context;
 }
Exemplo n.º 8
0
 public SetEntryPointHandler(ITransportRouteRepository transportRouteRepository,
                             IEntryOrExitPointRepository entryOrExitPointRepository,
                             IIntraCountryExportAllowedRepository intraCountryExportAllowedRepository,
                             IUnitedKingdomCompetentAuthorityRepository unitedKingdomCompetentAuthorityRepository,
                             IwsContext context)
 {
     this.transportRouteRepository                  = transportRouteRepository;
     this.entryOrExitPointRepository                = entryOrExitPointRepository;
     this.intraCountryExportAllowedRepository       = intraCountryExportAllowedRepository;
     this.unitedKingdomCompetentAuthorityRepository = unitedKingdomCompetentAuthorityRepository;
     this.context = context;
 }
Exemplo n.º 9
0
 public StateOfExportMap(ICountryRepository countryRepository, ICompetentAuthorityRepository competentAuthorityRepository,
                         IEntryOrExitPointRepository entryOrExitPointRepository,
                         IMap <Country, CountryData> countryMap,
                         IMap <CompetentAuthority, CompetentAuthorityData> competentAuthorityMap,
                         IMap <EntryOrExitPoint, EntryOrExitPointData> entryOrExitPointMap)
 {
     this.countryRepository            = countryRepository;
     this.competentAuthorityRepository = competentAuthorityRepository;
     this.entryOrExitPointRepository   = entryOrExitPointRepository;
     this.countryMap            = countryMap;
     this.competentAuthorityMap = competentAuthorityMap;
     this.entryOrExitPointMap   = entryOrExitPointMap;
 }
 public GetCompetentAuthoritiesAndEntryPointsByCountryIdHandler(IMap <EntryOrExitPoint, EntryOrExitPointData> entryOrExitPointMapper,
                                                                IMap <CompetentAuthority, CompetentAuthorityData> competentAuthorityMapper,
                                                                ICompetentAuthorityRepository competentAuthorityRepository,
                                                                IEntryOrExitPointRepository entryOrExitPointRepository,
                                                                IIntraCountryExportAllowedRepository intraCountryExportAllowedRepository,
                                                                IwsContext context,
                                                                IUnitedKingdomCompetentAuthorityRepository unitedKingdomCompetentAuthorityRepository)
 {
     this.entryOrExitPointRepository          = entryOrExitPointRepository;
     this.entryOrExitPointMapper              = entryOrExitPointMapper;
     this.competentAuthorityMapper            = competentAuthorityMapper;
     this.competentAuthorityRepository        = competentAuthorityRepository;
     this.intraCountryExportAllowedRepository = intraCountryExportAllowedRepository;
     this.context = context;
     this.unitedKingdomCompetentAuthorityRepository = unitedKingdomCompetentAuthorityRepository;
 }
        public StateOfExportValidatorTests()
        {
            entryOrExitPointRepository = A.Fake<IEntryOrExitPointRepository>();
            competentAuthorityRepository = A.Fake<ICompetentAuthorityRepository>();

            validator = new StateOfExportValidator(entryOrExitPointRepository, competentAuthorityRepository);

            A.CallTo(() => entryOrExitPointRepository.GetById(TestableEntryOrExitPoint.Calais.Id))
                .Returns(TestableEntryOrExitPoint.Calais);
            A.CallTo(() => competentAuthorityRepository.GetById(TestableCompetentAuthority.FrenchAuthorityArdeche.Id))
                .Returns(TestableCompetentAuthority.FrenchAuthorityArdeche);
            A.CallTo(() => competentAuthorityRepository.GetById(TestableCompetentAuthority.EnvironmentAgency.Id))
                .Returns(TestableCompetentAuthority.EnvironmentAgency);
            A.CallTo(() => entryOrExitPointRepository.GetById(TestableEntryOrExitPoint.Dover.Id))
                .Returns(TestableEntryOrExitPoint.Dover);
        }
Exemplo n.º 12
0
        public StateOfExportValidatorTests()
        {
            entryOrExitPointRepository   = A.Fake <IEntryOrExitPointRepository>();
            competentAuthorityRepository = A.Fake <ICompetentAuthorityRepository>();

            validator = new StateOfExportValidator(entryOrExitPointRepository, competentAuthorityRepository);

            A.CallTo(() => entryOrExitPointRepository.GetById(TestableEntryOrExitPoint.Calais.Id))
            .Returns(TestableEntryOrExitPoint.Calais);
            A.CallTo(() => competentAuthorityRepository.GetById(TestableCompetentAuthority.FrenchAuthorityArdeche.Id))
            .Returns(TestableCompetentAuthority.FrenchAuthorityArdeche);
            A.CallTo(() => competentAuthorityRepository.GetById(TestableCompetentAuthority.EnvironmentAgency.Id))
            .Returns(TestableCompetentAuthority.EnvironmentAgency);
            A.CallTo(() => entryOrExitPointRepository.GetById(TestableEntryOrExitPoint.Dover.Id))
            .Returns(TestableEntryOrExitPoint.Dover);
        }
Exemplo n.º 13
0
        public StateOfExportValidator(IEntryOrExitPointRepository entryOrExitPointRepository,
                                      ICompetentAuthorityRepository competentAuthorityRepository)
        {
            this.entryOrExitPointRepository   = entryOrExitPointRepository;
            this.competentAuthorityRepository = competentAuthorityRepository;

            RuleFor(x => x.CountryId)
            .NotNull()
            .WithLocalizedMessage(() => StateOfExportValidatorResources.StateOfExportCountryNotNull);

            RuleFor(x => x.ExitPointId)
            .MustAsync(BeInSameCountry)
            .WithLocalizedMessage(() => StateOfExportValidatorResources.ExportExitPointMustBeInSameCountry);

            RuleFor(x => x.CompetentAuthorityId)
            .MustAsync(BeInCountry)
            .WithLocalizedMessage(() => StateOfExportValidatorResources.CompetentAuthorityMustBeInSameCountry);
        }
Exemplo n.º 14
0
        public TransitStateValidator(IEntryOrExitPointRepository entryOrExitPointRepository,
                                     ICompetentAuthorityRepository competentAuthorityRepository)
        {
            this.competentAuthorityRepository = competentAuthorityRepository;
            this.entryOrExitPointRepository   = entryOrExitPointRepository;

            RuleFor(x => x.CountryId)
            .NotNull()
            .WithLocalizedMessage(() => TransitStateValidatorResources.CountryNotNull);

            RuleFor(x => x.EntryPointId)
            .MustAsync(BeEnteringSameCountry)
            .WithLocalizedMessage(() => TransitStateValidatorResources.EntryPointMustBeSelectedCountry);

            RuleFor(x => x.ExitPointId)
            .MustAsync(BeExitingSameCountry)
            .WithLocalizedMessage(() => TransitStateValidatorResources.ExitPointMustBeSelectedCountry);

            RuleFor(x => x.CompetentAuthorityId)
            .MustAsync(BeInSameCountry)
            .WithLocalizedMessage(() => TransitStateValidatorResources.CompetentAuthorityMustBeSelectedCountry);
        }
Exemplo n.º 15
0
        public StateOfImportValidator(ICountryRepository countryRepository,
                                      ICompetentAuthorityRepository competentAuthorityRepository,
                                      IEntryOrExitPointRepository entryOrExitPointRepository)
        {
            this.countryRepository            = countryRepository;
            this.competentAuthorityRepository = competentAuthorityRepository;
            this.entryOrExitPointRepository   = entryOrExitPointRepository;

            RuleFor(x => x.CompetentAuthorityId)
            .Cascade(CascadeMode.StopOnFirstFailure)
            .NotNull()
            .WithLocalizedMessage(() => StateOfImportValidatorResources.StateOfImportCompetentAuthorityNotEmpty)
            .MustAsync(BeACompetentAuthorityInTheUK)
            .WithLocalizedMessage(() => StateOfImportValidatorResources.StateOfImportCompetentAuthorityInUK);

            RuleFor(x => x.EntryPointId)
            .Cascade(CascadeMode.StopOnFirstFailure)
            .NotNull()
            .WithLocalizedMessage(() => StateOfImportValidatorResources.ImportEntryPointNotEmpty)
            .MustAsync(BeAnEntryPointInTheUK)
            .WithLocalizedMessage(() => StateOfImportValidatorResources.ImportEntryPointInUK);
        }
 public GetEntryOrExitPointsByCountryHandler(IEntryOrExitPointRepository entryOrExitPointRepository, IMap <EntryOrExitPoint, EntryOrExitPointData> mapper)
 {
     this.entryOrExitPointRepository = entryOrExitPointRepository;
     this.mapper = mapper;
 }
Exemplo n.º 17
0
 public CheckEntryOrExitPointUniqueHandler(IEntryOrExitPointRepository entryOrExitPointRepository)
 {
     this.entryOrExitPointRepository = entryOrExitPointRepository;
 }
 public GetEntryOrExitPointsGroupedByCountryHandler(IEntryOrExitPointRepository entryOrExitPointRepository,
                                                    IMapper mapper)
 {
     this.entryOrExitPointRepository = entryOrExitPointRepository;
     this.mapper = mapper;
 }
Exemplo n.º 19
0
 public StateOfImportMap(ICompetentAuthorityRepository competentAuthorityRepository,
                         IEntryOrExitPointRepository pointRepository)
 {
     this.competentAuthorityRepository = competentAuthorityRepository;
     this.pointRepository = pointRepository;
 }