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);
        }
 public SetStateOfExportForNotificationHandler(IwsContext context,
                                               ITransportRouteRepository transportRouteRepository,
                                               IIntraCountryExportAllowedRepository iceaRepository,
                                               IUnitedKingdomCompetentAuthorityRepository unitedKingdomCompetentAuthorityRepository)
 {
     this.context = context;
     this.transportRouteRepository = transportRouteRepository;
     this.iceaRepository           = iceaRepository;
     this.unitedKingdomCompetentAuthorityRepository = unitedKingdomCompetentAuthorityRepository;
 }
Exemple #3
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;
 }
 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;
 }
Exemple #5
0
 public TransportRouteMap(IwsContext context,
                          IMap <StateOfImport, StateOfImportData> stateOfImportMapper,
                          IMap <StateOfExport, StateOfExportData> stateOfExportMapper,
                          IMap <IEnumerable <TransitState>, IList <TransitStateData> > transitStateMapper,
                          IMap <EntryOrExitPoint, EntryOrExitPointData> entryOrExitPointMapper,
                          IMap <Country, CountryData> countryMapper,
                          IMap <CompetentAuthority, CompetentAuthorityData> competentAuthorityMapper,
                          IIntraCountryExportAllowedRepository intraCountryExportAllowedRepository,
                          IUnitedKingdomCompetentAuthorityRepository unitedKingdomCompetentAuthorityRepository)
 {
     this.context                                   = context;
     this.stateOfImportMapper                       = stateOfImportMapper;
     this.stateOfExportMapper                       = stateOfExportMapper;
     this.transitStateMapper                        = transitStateMapper;
     this.entryOrExitPointMapper                    = entryOrExitPointMapper;
     this.countryMapper                             = countryMapper;
     this.competentAuthorityMapper                  = competentAuthorityMapper;
     this.intraCountryExportAllowedRepository       = intraCountryExportAllowedRepository;
     this.unitedKingdomCompetentAuthorityRepository = unitedKingdomCompetentAuthorityRepository;
 }
 public GetStateOfImportWithTransportRouteDataByNotificationIdHandler(IwsContext context,
                                                                      IMapper mapper,
                                                                      ITransportRouteRepository transportRouteRepository,
                                                                      ICompetentAuthorityRepository competentAuthorityRepository,
                                                                      ICountryRepository countryRepository,
                                                                      IIntraCountryExportAllowedRepository intraCountryExportAllowedRepository,
                                                                      INotificationApplicationRepository notificationApplicationRepository,
                                                                      IRequestHandler <GetCompetentAuthoritiesAndEntryPointsByCountryId, CompetentAuthorityAndEntryOrExitPointData> getCompetentAuthoritiesAndEntryPointsByCountryIdHandler,
                                                                      IUnitedKingdomCompetentAuthorityRepository unitedKingdomCompetentAuthorityRepository)
 {
     this.context = context;
     this.mapper  = mapper;
     this.transportRouteRepository            = transportRouteRepository;
     this.competentAuthorityRepository        = competentAuthorityRepository;
     this.countryRepository                   = countryRepository;
     this.intraCountryExportAllowedRepository = intraCountryExportAllowedRepository;
     this.notificationApplicationRepository   = notificationApplicationRepository;
     this.getCompetentAuthoritiesAndEntryPointsByCountryIdHandler = getCompetentAuthoritiesAndEntryPointsByCountryIdHandler;
     this.unitedKingdomCompetentAuthorityRepository = unitedKingdomCompetentAuthorityRepository;
 }