public SetExitCustomsOfficeForNotificationByIdHandlerTests()
        {
            this.context = new TestIwsContext();
            var repository = A.Fake<ITransportRouteRepository>();

            anyNotification = NotificationApplicationFactory.Create(TestIwsContext.UserId, NotificationType.Recovery, UKCompetentAuthority.England, 0);
            EntityHelper.SetEntityId(anyNotification, notificationId);

            transport = new TransportRoute(notificationId);

            context.NotificationApplications.Add(anyNotification);
            context.TransportRoutes.Add(transport);

            country = CountryFactory.Create(AnyGuid);
            nonEuCountry = CountryFactory.Create(new Guid("606ECF5A-6571-4803-9CCA-7E1AF82D147A"), "test", false);

            context.Countries.AddRange(new[]
            {
                country,
                nonEuCountry
            });

            stateOfExport = new StateOfExport(country,
                CompetentAuthorityFactory.Create(AnyGuid, country),
                EntryOrExitPointFactory.Create(AnyGuid, country));

            stateOfImportNonEu = new StateOfImport(nonEuCountry,
                CompetentAuthorityFactory.Create(new Guid("5E4F1F22-5054-449B-9EC7-933A43BB5D6D"), nonEuCountry),
                EntryOrExitPointFactory.Create(new Guid("9781324F-17B8-4009-89B2-C18963E3E6E1"), nonEuCountry));

            A.CallTo(() => repository.GetByNotificationId(notificationId)).Returns(transport);

            this.handler = new SetExitCustomsOfficeForNotificationByIdHandler(context, repository);
        }
        public GetExitCustomsOfficeAddDataByNotificationIdTests()
        {
            context = new TestIwsContext();
            var repository = A.Fake<ITransportRouteRepository>();

            country = CountryFactory.Create(new Guid("05C21C57-2F39-4A15-A09A-5F38CF139C05"));
            exitCustomsOffice = new ExitCustomsOffice("any name", "any address", country);

            notification = NotificationApplicationFactory.Create(TestIwsContext.UserId, NotificationType.Recovery,
                UKCompetentAuthority.England, 500);

            transport = new TransportRoute(NotificationId);

            EntityHelper.SetEntityId(notification, NotificationId);

            context.Countries.Add(country);
            context.NotificationApplications.Add(notification);
            context.TransportRoutes.Add(transport);

            A.CallTo(() => repository.GetByNotificationId(NotificationId)).Returns(transport);

            handler = new GetExitCustomsOfficeAddDataByNotificationIdHandler(repository,
                new CustomsOfficeExitMap(context,
                                            new CountryMap(),
                                            new CustomsOfficeMap(new CountryMap())));
        }
 public static UKCompetentAuthority Create(Guid id, Country country)
 {
     var competentAuthority = ObjectInstantiator<UKCompetentAuthority>.CreateNew();
     ObjectInstantiator<UKCompetentAuthority>.SetProperty(x => x.Country, country, competentAuthority);
     ObjectInstantiator<UKCompetentAuthority>.SetProperty(x => x.Id, id, competentAuthority);
     return competentAuthority;
 }
        public static EntryOrExitPoint Create(Guid id, Country country)
        {
            var point = ObjectInstantiator<EntryOrExitPoint>.CreateNew();
            ObjectInstantiator<EntryOrExitPoint>.SetProperty(x => x.Id, id, point);
            ObjectInstantiator<EntryOrExitPoint>.SetProperty(x => x.Country, country, point);

            return point;
        }
 public static Address CreateAddress(AddressData address, Country country)
 {
     return new Address(address.Address1,
         address.Address2,
         address.TownOrCity,
         address.CountyOrRegion,
         address.Postcode,
         country,
         address.Telephone,
         address.Email);
 }
        public static TransitState Create(Guid id, Country country, int ordinalPosition)
        {
            // Note that the use of Guid.NewGuid() is non-deterministic and may cause random test failures.
            var transitState = new TransitState(country,
                CompetentAuthorityFactory.Create(Guid.NewGuid(), country),
                EntryOrExitPointFactory.Create(Guid.NewGuid(), country),
                EntryOrExitPointFactory.Create(Guid.NewGuid(), country),
                ordinalPosition);

            EntityHelper.SetEntityId(transitState, id);

            return transitState;
        }
 public async Task<IEnumerable<EntryOrExitPoint>> GetForCountry(Country country)
 {
     return await GetForCountry(country.Id);
 }
Beispiel #8
0
 public IQueryable <Domain.City> GetCity(Domain.Country country, [ScopedService] GeoDbContext context)
 {
     return(context.Cities.Where(i => i.CountryId == country.Id));
 }
 private static Address TestAddress(Country country)
 {
     return new Address("test street", null, "Woking", null, "GU22 7UM", country.Name);
 }
 private static TransitState TransitState(Country country, string name)
 {
     var ca = CompetentAuthorityFactory.Create(Guid.Empty, country);
     var state = new TransitState(country, ca, EntryOrExitPointFactory.Create(Guid.Empty, country, name), EntryOrExitPointFactory.Create(Guid.NewGuid(), country, name), 1);
     return state;
 }