public ImportNotificationApplicationAuthorization(IwsContext context, ImportNotificationContext importNotificationContext, IUserContext userContext) { this.context = context; this.importNotificationContext = importNotificationContext; this.userContext = userContext; }
public async Task CopyAsync(IwsContext context, Guid notificationSourceId, Guid notificationDestinationId) { var originalFacilities = await context.Facilities .AsNoTracking() .Include("FacilitiesCollection") .SingleOrDefaultAsync(f => f.NotificationId == notificationSourceId); var newFacilities = new FacilityCollection(notificationDestinationId); if (originalFacilities != null) { foreach (var facility in originalFacilities.Facilities) { var newFacility = newFacilities.AddFacility(facility.Business, facility.Address, facility.Contact); if (facility.IsActualSiteOfTreatment) { typeof(Facility).GetProperty("IsActualSiteOfTreatment") .SetValue(newFacility, true, null); } } typeof(FacilityCollection).GetProperty("AllFacilitiesPreconsented") .SetValue(newFacilities, originalFacilities.AllFacilitiesPreconsented, null); } context.Facilities.Add(newFacilities); }
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 async Task CopyAsync(IwsContext context, Guid notificationSourceId, Guid notificationDestinationId) { var originalProducers = await context.Producers .AsNoTracking() .Include("ProducersCollection") .SingleOrDefaultAsync(p => p.NotificationId == notificationSourceId); var newProducers = new ProducerCollection(notificationDestinationId); if (originalProducers != null) { foreach (var producer in originalProducers.Producers) { var newProducer = newProducers.AddProducer(producer.Business, producer.Address, producer.Contact); if (producer.IsSiteOfExport) { typeof(Producer).GetProperty("IsSiteOfExport") .SetValue(newProducer, true, null); } } } context.Producers.Add(newProducers); }
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 async Task CopyAsync(IwsContext context, Guid sourceId, Guid destinationId) { var clonedWasteRecovery = await context.Set<WasteRecovery>() .AsNoTracking() .SingleOrDefaultAsync(n => n.NotificationId == sourceId); if (clonedWasteRecovery != null) { typeof(WasteRecovery).GetProperty("NotificationId") .SetValue(clonedWasteRecovery, destinationId, null); typeof(Entity).GetProperty("Id").SetValue(clonedWasteRecovery, Guid.Empty, null); context.WasteRecoveries.Add(clonedWasteRecovery); } var clonedWasteDisposal = await context.Set<WasteDisposal>() .AsNoTracking() .SingleOrDefaultAsync(n => n.NotificationId == sourceId); if (clonedWasteDisposal != null) { typeof(WasteDisposal).GetProperty("NotificationId") .SetValue(clonedWasteDisposal, destinationId, null); typeof(Entity).GetProperty("Id").SetValue(clonedWasteDisposal, Guid.Empty, null); context.WasteDisposals.Add(clonedWasteDisposal); } }
public GetNotificationsToCopyForUserHandlerTests() { userContext = new TestUserContext(UserWithNotificationsId); context = new TestIwsContext(userContext); var notification1 = NotificationApplicationFactory.Create(UserWithNotificationsId, NotificationType.Recovery, UKCompetentAuthority.England, 1); EntityHelper.SetEntityId(notification1, Notification1Id); var importer1 = ImporterFactory.Create(Notification1Id, new Guid("DA0C2B9A-3370-4265-BA0D-2F7030241E7C")); ObjectInstantiator<NotificationApplication>.SetProperty(x => x.WasteType, WasteType.CreateOtherWasteType("wood"), notification1); var notification2 = NotificationApplicationFactory.Create(UserWithNotificationsId, NotificationType.Recovery, UKCompetentAuthority.England, 2); EntityHelper.SetEntityId(notification2, Notification2Id); var importer2 = ImporterFactory.Create(Notification2Id, new Guid("CD8FE7F5-B0EF-47E4-A198-D1E531A6CCDF")); ObjectInstantiator<NotificationApplication>.SetProperty(x => x.WasteType, WasteType.CreateRdfWasteType(new List<WasteAdditionalInformation> { WasteAdditionalInformation.CreateWasteAdditionalInformation("toffee", 1, 10, WasteInformationType.AshContent) }), notification2); var notification3 = NotificationApplicationFactory.Create(UserWithNotificationsId, NotificationType.Disposal, UKCompetentAuthority.England, 1); EntityHelper.SetEntityId(notification3, Notification3Id); var importer3 = ImporterFactory.Create(Notification3Id, new Guid("AF7ADA0A-E81B-4A7F-9837-52591B219DD3")); ObjectInstantiator<NotificationApplication>.SetProperty(x => x.WasteType, WasteType.CreateOtherWasteType("wood"), notification3); var destinationNotification = NotificationApplicationFactory.Create(UserWithNotificationsId, NotificationType.Recovery, UKCompetentAuthority.England, 1); EntityHelper.SetEntityId(destinationNotification, DestinationNotificationId); var destinationNotification2 = NotificationApplicationFactory.Create(UserWithoutNotificationsId, NotificationType.Recovery, UKCompetentAuthority.England, 1); EntityHelper.SetEntityId(destinationNotification2, DestinationNotificationId2); context.NotificationApplications.AddRange(new[] { notification1, notification2, notification3, destinationNotification, destinationNotification2 }); context.Exporters.AddRange(new[] { CreateExporter(Notification1Id), CreateExporter(Notification2Id), CreateExporter(Notification3Id) }); context.Importers.AddRange(new[] { importer1, importer2, importer3 }); handler = new GetNotificationsToCopyForUserHandler(context, userContext); }
public CreateMovementInternalHandlerTests() { context = new TestIwsContext(); factory = A.Fake<ICapturedMovementFactory>(); movementRepository = A.Fake<IMovementRepository>(); handler = new CreateMovementInternalHandler(factory, movementRepository, context); }
public AdvancedSearchRepositoryIntegration() { var userContext = A.Fake<IUserContext>(); A.CallTo(() => userContext.UserId).Returns(Guid.NewGuid()); context = new IwsContext(userContext, A.Fake<IEventDispatcher>()); }
public NotificationMovementsSummaryRepository(INotificationApplicationAuthorization notificationAuthorization, NotificationMovementsQuantity quantity, IwsContext context) { this.quantity = quantity; this.notificationAuthorization = notificationAuthorization; this.context = context; }
public PricingStructureIntegration() { var userContext = A.Fake<IUserContext>(); A.CallTo(() => userContext.UserId).Returns(Guid.NewGuid()); context = new IwsContext(userContext, A.Fake<IEventDispatcher>()); }
public NotificationApplicationIntegration() { var userContext = A.Fake<IUserContext>(); A.CallTo(() => userContext.UserId).Returns(Guid.NewGuid()); context = new IwsContext(userContext, A.Fake<IEventDispatcher>()); }
public RelationshipDeletionIntegration() { userId = new Guid("5BA5B2CE-A29C-4B94-A528-567F636CA456"); userContext = A.Fake<IUserContext>(); A.CallTo(() => userContext.UserId).Returns(userId); context = new IwsContext(userContext, A.Fake<IEventDispatcher>()); notification = NotificationApplicationFactory.Create(userId, NotificationType.Recovery, UKCompetentAuthority.England, 0); }
public WasteRecoveryIntegration() { var userContext = A.Fake<IUserContext>(); A.CallTo(() => userContext.UserId).Returns(Guid.NewGuid()); eventDispatcher = A.Fake<IEventDispatcher>(); context = new IwsContext(userContext, eventDispatcher); }
public NotificationApplicationOverviewRepository( IwsContext db, INotificationChargeCalculator chargeCalculator, INotificationProgressService progressService, INotificationApplicationAuthorization authorization) { this.db = db; this.chargeCalculator = chargeCalculator; this.progressService = progressService; this.authorization = authorization; }
public NotificationCreatedEventHandlerTests() { context = new TestIwsContext(); var notification = NotificationApplicationFactory.Create(Guid.Empty, NotificationType.Recovery, UKCompetentAuthority.England, 0); EntityHelper.SetEntityId(notification, notificationId); message = new NotificationCreatedEvent(notification); handler = new NotificationCreatedEventHandler(context); }
public NotificationStatusChangeEventHandlerTests() { context = new TestIwsContext(); var userContext = new TestUserContext(UserId); handler = new NotificationStatusChangeEventHandler(context, userContext); context.Users.Add(UserFactory.Create(UserId, AnyString, AnyString, AnyString, AnyString)); notificationAssessment = new NotificationAssessment(NotificationId); receivedEvent = new NotificationStatusChangeEvent(notificationAssessment, NotificationStatus.Submitted); }
public FinancialGuaranteeStatusChangeEventHandlerTests() { context = new TestIwsContext(); var userContext = new TestUserContext(UserId); handler = new FinancialGuaranteeStatusChangeEventHandler(context, userContext); context.Users.Add(UserFactory.Create(UserId, AnyString, AnyString, AnyString, AnyString)); financialGuarantee = new FinancialGuaranteeCollection(new Guid("68787AC6-7CF5-4862-8E7E-77E20172AECC")).AddFinancialGuarantee(new DateTime(2015, 1, 1)); receivedEvent = new FinancialGuaranteeStatusChangeEvent(financialGuarantee, FinancialGuaranteeStatus.ApplicationReceived); }
public async Task CopyAsync(IwsContext context, Guid sourceId, Guid destinationId) { var clonedImporter = await context.Set<Importer>() .AsNoTracking() .SingleOrDefaultAsync(e => e.NotificationId == sourceId); if (clonedImporter != null) { typeof(Importer).GetProperty("NotificationId") .SetValue(clonedImporter, destinationId, null); typeof(Entity).GetProperty("Id") .SetValue(clonedImporter, Guid.Empty, null); context.Importers.Add(clonedImporter); } }
public SubmitNotificationHandlerTests() { context = new TestIwsContext(); progressService = A.Fake<INotificationProgressService>(); var assessment = new NotificationAssessment(notificationId); var repo = A.Fake<INotificationAssessmentRepository>(); A.CallTo(() => repo.GetByNotificationId(notificationId)).Returns(assessment); context.NotificationAssessments.Add(assessment); A.CallTo(() => progressService.IsComplete(notificationId)).Returns(true); handler = new SubmitNotificationHandler(context, progressService, repo); message = new SubmitNotification(notificationId); }
public async Task CopyAsync(IwsContext context, Guid sourceId, Guid destinationId) { var clonedMeans = await context.Set<MeansOfTransport>() .AsNoTracking() .SingleOrDefaultAsync(x => x.NotificationId == sourceId); if (clonedMeans != null) { typeof(MeansOfTransport).GetProperty("NotificationId") .SetValue(clonedMeans, destinationId, null); typeof(Entity).GetProperty("Id") .SetValue(clonedMeans, Guid.Empty, null); context.MeansOfTransports.Add(clonedMeans); } }
public GetOrganisationDetailsByUserHandlerTests() { userContext = A.Fake<IUserContext>(); A.CallTo(() => userContext.UserId).Returns(userId); context = new TestIwsContext(userContext); var country = CountryFactory.Create(new Guid("05C21C57-2F39-4A15-A09A-5F38CF139C05")); context.Countries.Add(country); context.Organisations.Add(GetOrganisation()); context.Users.Add(GetUser()); message = new GetOrganisationDetailsByUser(); handler = new GetOrganisationDetailsByUserHandler(context, userContext); }
public WorkingDayCalculatorTests() { context = new TestIwsContext(); var bankHoliday = ObjectInstantiator<BankHoliday>.CreateNew(); ObjectInstantiator<BankHoliday>.SetProperty(bh => bh.CompetentAuthority, UKCompetentAuthority.England, bankHoliday); ObjectInstantiator<BankHoliday>.SetProperty(bh => bh.Date, Tuesday14thJuly2015BankHoliday, bankHoliday); var secondBankHoliday = ObjectInstantiator<BankHoliday>.CreateNew(); ObjectInstantiator<BankHoliday>.SetProperty(bh => bh.CompetentAuthority, UKCompetentAuthority.England, secondBankHoliday); ObjectInstantiator<BankHoliday>.SetProperty(bh => bh.Date, Friday24thJuly2015BankHoliday, secondBankHoliday); context.BankHolidays.AddRange(new[] { bankHoliday, secondBankHoliday }); calculator = new WorkingDayCalculator(context); }
public UpdateOrganisationDetailsHandlerTests() { userContext = A.Fake<IUserContext>(); A.CallTo(() => userContext.UserId).Returns(userId); context = new TestIwsContext(userContext); var country = CountryFactory.Create(countryId); context.Countries.Add(country); address = new Address(address1, address2, town, null, postcode, country.Name); context.Organisations.Add(GetOrganisation()); context.Users.Add(GetUser()); handler = new UpdateOrganisationDetailsHandler(context, userContext); }
public async Task CopyAsync(IwsContext context, Guid notificationSourceId, Guid notificationDestinationId) { var originalCarriers = await context.Carriers .AsNoTracking() .Include("CarriersCollection") .SingleOrDefaultAsync(c => c.NotificationId == notificationSourceId); var newCarriers = new CarrierCollection(notificationDestinationId); if (originalCarriers != null) { foreach (var carrier in originalCarriers.Carriers) { var newCarrier = newCarriers.AddCarrier(carrier.Business, carrier.Address, carrier.Contact); } } context.Carriers.Add(newCarriers); }
public GetCustomsOfficeRequiredStatusByNotificationIdHandlerTests() { notification1 = NotificationApplicationFactory.Create(TestIwsContext.UserId, NotificationType.Recovery, UKCompetentAuthority.England, 500); notificationId = new Guid("295B0511-D0EB-43B4-9D17-938E1A34F0D3"); EntityHelper.SetEntityId(notification1, notificationId); var transport = new TransportRoute(notificationId); context = new TestIwsContext(); context.NotificationApplications.Add(notification1); context.TransportRoutes.Add(transport); var repository = A.Fake<ITransportRouteRepository>(); A.CallTo(() => repository.GetByNotificationId(notificationId)).Returns(transport); handler = new GetCustomsCompletionStatusByNotificationIdHandler(repository); }
public SetUserApprovalsHandlerTests() { userContext = new TestUserContext(Guid.Empty); context = new TestIwsContext(userContext); context.InternalUsers.AddRange(new InternalUserCollection().Users); var userManager = A.Fake<UserManager<ApplicationUser>>(); handler = new SetUserApprovalsHandler(context, userContext, userManager); approvePendingAdminMessage = new SetUserApprovals(new[] { new UserApproval(InternalUserCollection.AdminPendingId, ApprovalAction.Approve, UserRole.Administrator) }); getUserStatusFromContext = (id, ctxt) => { return ctxt.InternalUsers.Single(u => u.UserId == id.ToString()).Status; }; }
public RemoveTransitStateForNotificationHandlerTests() { var userContext = A.Fake<IUserContext>(); A.CallTo(() => userContext.UserId).Returns(Guid.Empty); context = new TestIwsContext(userContext); var notification = NotificationApplicationFactory.Create(ExistingNotificationId); var transport = new TransportRoute(ExistingNotificationId); transport.AddTransitStateToNotification(TransitStateFactory.Create(ExistingTransitStateId, CountryFactory.Create(new Guid("3E7A0092-B6CB-46AD-ABCC-FB741EB6CF35")), 1)); context.NotificationApplications.Add(notification); context.TransportRoutes.Add(transport); var repository = A.Fake<ITransportRouteRepository>(); A.CallTo(() => repository.GetByNotificationId(ExistingNotificationId)).Returns(transport); handler = new RemoveTransitStateForNotificationHandler(context, repository); }
public ExternalUserExistsHandler(IwsContext context) { this.context = context; }
public SetNewNumberOfShipmentsHandler(IwsContext context, INumberOfShipmentsHistotyRepository shipmentHistotyRepository, IShipmentInfoRepository shipmentInfoRepository) { this.context = context; this.shipmentHistotyRepository = shipmentHistotyRepository; this.shipmentInfoRepository = shipmentInfoRepository; }
public CountryRepository(IwsContext context) { this.context = context; }
public SharedUserHistoryRepository(IwsContext context) { this.context = context; }
public ChangeUserHandler(ChangeNotificationUser changeNotificationUser, IwsContext context) { this.changeNotificationUser = changeNotificationUser; this.context = context; }
public RecordReceiptInternalHandler(IMovementRepository movementRepository, IwsContext context, IUserContext userContext) { this.movementRepository = movementRepository; this.context = context; this.userContext = userContext; }
public ImportStatsRepository(IwsContext context) { this.context = context; }
public NotificationAssessmentRepository(IwsContext context, INotificationApplicationAuthorization authorization) { this.context = context; this.authorization = authorization; }
public AcceptChangesHandler(INotificationAssessmentRepository repository, IwsContext context) { this.repository = repository; this.context = context; }
public RecordUserChange(IUserHistoryRepository repository, IwsContext context) { this.repository = repository; this.context = context; }
public DeleteCustomsOfficesWhenAllTransitStatesInEU(IwsContext context) { this.context = context; }
public GetNotificationsToCopyForUserHandlerTests() { userContext = new TestUserContext(UserWithNotificationsId); context = new TestIwsContext(userContext); var notification1 = NotificationApplicationFactory.Create(UserWithNotificationsId, NotificationType.Recovery, UKCompetentAuthority.England, 1); EntityHelper.SetEntityId(notification1, Notification1Id); var importer1 = ImporterFactory.Create(Notification1Id, new Guid("DA0C2B9A-3370-4265-BA0D-2F7030241E7C")); ObjectInstantiator <NotificationApplication> .SetProperty(x => x.WasteType, WasteType.CreateOtherWasteType("wood"), notification1); var notification2 = NotificationApplicationFactory.Create(UserWithNotificationsId, NotificationType.Recovery, UKCompetentAuthority.England, 2); EntityHelper.SetEntityId(notification2, Notification2Id); var importer2 = ImporterFactory.Create(Notification2Id, new Guid("CD8FE7F5-B0EF-47E4-A198-D1E531A6CCDF")); ObjectInstantiator <NotificationApplication> .SetProperty(x => x.WasteType, WasteType.CreateRdfWasteType(new List <WasteAdditionalInformation> { WasteAdditionalInformation.CreateWasteAdditionalInformation("toffee", 1, 10, WasteInformationType.AshContent) }), notification2); var notification3 = NotificationApplicationFactory.Create(UserWithNotificationsId, NotificationType.Disposal, UKCompetentAuthority.England, 1); EntityHelper.SetEntityId(notification3, Notification3Id); var importer3 = ImporterFactory.Create(Notification3Id, new Guid("AF7ADA0A-E81B-4A7F-9837-52591B219DD3")); ObjectInstantiator <NotificationApplication> .SetProperty(x => x.WasteType, WasteType.CreateOtherWasteType("wood"), notification3); var destinationNotification = NotificationApplicationFactory.Create(UserWithNotificationsId, NotificationType.Recovery, UKCompetentAuthority.England, 1); EntityHelper.SetEntityId(destinationNotification, DestinationNotificationId); var destinationNotification2 = NotificationApplicationFactory.Create(UserWithoutNotificationsId, NotificationType.Recovery, UKCompetentAuthority.England, 1); EntityHelper.SetEntityId(destinationNotification2, DestinationNotificationId2); context.NotificationApplications.AddRange(new[] { notification1, notification2, notification3, destinationNotification, destinationNotification2 }); context.Exporters.AddRange(new[] { CreateExporter(Notification1Id), CreateExporter(Notification2Id), CreateExporter(Notification3Id) }); context.Importers.AddRange(new[] { importer1, importer2, importer3 }); handler = new GetNotificationsToCopyForUserHandler(context, userContext); }
public WasteDisposalRepository(IwsContext context, INotificationApplicationAuthorization notificationApplicationAuthorization) { this.context = context; this.notificationApplicationAuthorization = notificationApplicationAuthorization; }
public SearchExportNotificationsHandler(IwsContext context, IUserContext userContext) { this.context = context; this.userContext = userContext; }
public SharedUserRepository(IwsContext context, INotificationApplicationAuthorization authorization) { this.context = context; this.authorization = authorization; }
public GetUserIsInternalHandler(IwsContext context) { this.context = context; }
public MovementAuditRepository(IwsContext context, INotificationApplicationAuthorization notificationApplicationAuthorization) { this.context = context; this.notificationApplicationAuthorization = notificationApplicationAuthorization; }
public GetPackagingInfoForNotificationHandler(IwsContext context, IMap <NotificationApplication, PackagingData> packagingMapper) { this.context = context; this.packagingMapper = packagingMapper; }
public SetNotificationReceivedDateHandler(IwsContext context) { this.context = context; }
public static void DeleteDataForNotification(Guid notificationId, IwsContext context) { context.Database.ExecuteSqlCommand(TransactionalBehavior.DoNotEnsureTransaction, string.Format(deleteCommand, notificationId)); }
public CreateInternalUserHandler(IwsContext context) { this.context = context; }
public MeansOfTransportRepository(IwsContext context, INotificationApplicationAuthorization authorization) { this.context = context; this.authorization = authorization; }
public UserByIdHandler(IwsContext context) { this.context = context; }
public MovementRejectionRepository(IwsContext context) { this.context = context; }
public NotificationApplicationAuthorization(IwsContext context, IUserContext userContext) { this.context = context; this.userContext = userContext; }
public NotificationAuditScreenRepository(IwsContext context) { this.context = context; }
public RecordRejectionInternalHandler(IRejectMovement rejectMovement, IwsContext context) { this.rejectMovement = rejectMovement; this.context = context; }
public GetNewInternalUsersHandler(IwsContext context, IMap <InternalUser, InternalUserData> userMap, IUserContext userContext) { this.context = context; this.userMap = userMap; this.userContext = userContext; }
public SetPhysicalCharacteristicsHandler(IwsContext context, IMap <SetPhysicalCharacteristics, IList <PhysicalCharacteristicsInfo> > mapper) { this.context = context; this.mapper = mapper; }
public GetCountriesHandler(IwsContext context) { this.context = context; }