public void UpdatePackagingInfoReplacesItems() { var notification = new NotificationApplication(Guid.NewGuid(), NotificationType.Recovery, UKCompetentAuthority.England, 0); var packagingInfos = new List<PackagingInfo> { PackagingInfo.CreateOtherPackagingInfo("package description"), PackagingInfo.CreatePackagingInfo(PackagingType.Bag) }; var newPackagingInfos = new List<PackagingInfo> { PackagingInfo.CreatePackagingInfo(PackagingType.Box), PackagingInfo.CreatePackagingInfo(PackagingType.Bulk) }; notification.SetPackagingInfo(packagingInfos); notification.SetPackagingInfo(newPackagingInfos); Assert.Collection(notification.PackagingInfos, item => Assert.Equal(notification.PackagingInfos.ElementAt(0).PackagingType, PackagingType.Box), item => Assert.Equal(notification.PackagingInfos.ElementAt(1).PackagingType, PackagingType.Bulk)); }
public WasteRecoveryBlock(IList<MergeField> mergeFields, NotificationApplication notification, WasteRecovery wasteRecovery, WasteDisposal wasteDisposal) { AnnexMergeFields = MergeFieldLocator.GetAnnexMergeFields(mergeFields, TypeName); CorrespondingMergeFields = MergeFieldLocator.GetCorrespondingFieldsForBlock(mergeFields, TypeName); data = new WasteRecoveryViewModel(notification, wasteRecovery, wasteDisposal, new WasteRecoveryFormatter()); if (notification.NotificationType == NotificationType.Disposal) { HasAnnex = false; MergeMainDocumentBlock(); } else { HasAnnex = true; if (notification.WasteRecoveryInformationProvidedByImporter.GetValueOrDefault()) { HasAnnex = false; MergeMainDocumentBlock(); } } }
public File CreateForNotification(IAnnexNameGenerator annexNameGenerator, NotificationApplication notification, byte[] annexBytes, string fileType) { var name = annexNameGenerator.GetValue(notification); return(new File(name, fileType, annexBytes)); }
public OperationBlock(IList <MergeField> mergeFields, NotificationApplication notification, TechnologyEmployed technologyEmployed) { CorrespondingMergeFields = MergeFieldLocator.GetCorrespondingFieldsForBlock(mergeFields, TypeName); data = new OperationViewModel(notification, technologyEmployed, new OperationInfoFormatter()); AnnexMergeFields = MergeFieldLocator.GetAnnexMergeFields(mergeFields, TypeName); }
private static NotificationApplication CreateNotificationApplication() { var notification = new NotificationApplication(Guid.NewGuid(), NotificationType.Recovery, UKCompetentAuthority.England, 0); return(notification); }
public WasteCodesBlock(IList <MergeField> mergeFields, NotificationApplication notification) { CorrespondingMergeFields = MergeFieldLocator.GetCorrespondingFieldsForBlock(mergeFields, TypeName); data = new WasteCodesViewModel(notification, new WasteCodeInfoFormatter()); AnnexMergeFields = MergeFieldLocator.GetAnnexMergeFields(mergeFields, TypeName); }
public string GetValueForMergeField(MergeField mergeField, NotificationApplication notification) { if (mergeField.FieldName.InnerTypeName.Equals("Number")) { return(notification.NotificationNumber); } if (notification.NotificationType == NotificationType.Disposal) { if (mergeField.FieldName.InnerTypeName.Equals("IsDisposal")) { return("☑"); } if (mergeField.FieldName.InnerTypeName.Equals("IsRecovery")) { return("☐"); } } if (notification.NotificationType == NotificationType.Recovery) { if (mergeField.FieldName.InnerTypeName.Equals("IsRecovery")) { return("☑"); } if (mergeField.FieldName.InnerTypeName.Equals("IsDisposal")) { return("☐"); } } return(String.Empty); }
public OperationBlock(IList<MergeField> mergeFields, NotificationApplication notification, TechnologyEmployed technologyEmployed) { CorrespondingMergeFields = MergeFieldLocator.GetCorrespondingFieldsForBlock(mergeFields, TypeName); data = new OperationViewModel(notification, technologyEmployed, new OperationInfoFormatter()); AnnexMergeFields = MergeFieldLocator.GetAnnexMergeFields(mergeFields, TypeName); }
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 File CreateForNotification(IAnnexNameGenerator annexNameGenerator, NotificationApplication notification, byte[] annexBytes, string fileType) { var name = annexNameGenerator.GetValue(notification); return new File(name, fileType, annexBytes); }
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()))); }
private static NotificationApplication CreateNotificationApplication() { var notification = new NotificationApplication(Guid.NewGuid(), NotificationType.Recovery, UKCompetentAuthority.England, 0); return notification; }
protected void SetUnNumbersAndShippingNames(NotificationApplication notification) { UnNumber = string.Empty; UnNumberAndShippingName = string.Empty; UnShippingName = string.Empty; var separator = ", "; if (notification.UnNumbers == null) { return; } if (notification.UnNumbers.Any(c => c.IsNotApplicable)) { UnNumber = NotApplicable; UnNumberAndShippingName = UnNumber; return; } var codes = notification.UnNumbers.OrderBy(c => c.WasteCode.Code); UnNumber = string.Join(separator, codes.Select(c => c.WasteCode.Code)); UnShippingName = string.Join(separator, codes.Select(c => c.WasteCode.Description)); UnNumberAndShippingName = string.Join(Environment.NewLine, codes.Select(c => c.WasteCode.Code + " - " + c.WasteCode.Description)); }
public string GetValueForMergeField(MergeField mergeField, NotificationApplication notification) { if (mergeField.FieldName.InnerTypeName.Equals("Number")) { return notification.NotificationNumber; } if (notification.NotificationType == NotificationType.Disposal) { if (mergeField.FieldName.InnerTypeName.Equals("IsDisposal")) { return "☑"; } if (mergeField.FieldName.InnerTypeName.Equals("IsRecovery")) { return "☐"; } } if (notification.NotificationType == NotificationType.Recovery) { if (mergeField.FieldName.InnerTypeName.Equals("IsRecovery")) { return "☑"; } if (mergeField.FieldName.InnerTypeName.Equals("IsDisposal")) { return "☐"; } } return String.Empty; }
public WasteRecoveryBlock(IList <MergeField> mergeFields, NotificationApplication notification, WasteRecovery wasteRecovery, WasteDisposal wasteDisposal) { AnnexMergeFields = MergeFieldLocator.GetAnnexMergeFields(mergeFields, TypeName); CorrespondingMergeFields = MergeFieldLocator.GetCorrespondingFieldsForBlock(mergeFields, TypeName); data = new WasteRecoveryViewModel(notification, wasteRecovery, wasteDisposal, new WasteRecoveryFormatter()); if (notification.NotificationType == NotificationType.Disposal) { HasAnnex = false; MergeMainDocumentBlock(); } else { HasAnnex = true; if (notification.WasteRecoveryInformationProvidedByImporter.GetValueOrDefault()) { HasAnnex = false; MergeMainDocumentBlock(); } } }
public WasteCodesBlock(IList<MergeField> mergeFields, NotificationApplication notification) { CorrespondingMergeFields = MergeFieldLocator.GetCorrespondingFieldsForBlock(mergeFields, TypeName); data = new WasteCodesViewModel(notification, new WasteCodeInfoFormatter()); AnnexMergeFields = MergeFieldLocator.GetAnnexMergeFields(mergeFields, TypeName); }
public void UpdatePackagingInfoReplacesItems() { var notification = new NotificationApplication(Guid.NewGuid(), NotificationType.Recovery, UKCompetentAuthority.England, 0); var packagingInfos = new List <PackagingInfo> { PackagingInfo.CreateOtherPackagingInfo("package description"), PackagingInfo.CreatePackagingInfo(PackagingType.Bag) }; var newPackagingInfos = new List <PackagingInfo> { PackagingInfo.CreatePackagingInfo(PackagingType.Box), PackagingInfo.CreatePackagingInfo(PackagingType.Bulk) }; notification.SetPackagingInfo(packagingInfos); notification.SetPackagingInfo(newPackagingInfos); Assert.Collection(notification.PackagingInfos, item => Assert.Equal(notification.PackagingInfos.ElementAt(0).PackagingType, PackagingType.Box), item => Assert.Equal(notification.PackagingInfos.ElementAt(1).PackagingType, PackagingType.Bulk)); }
public SharedUserRepositoryTests() { ownerUser = UserFactory.Create(Guid.NewGuid(), "Owner", "User", "12345", "*****@*****.**"); sharedUser = UserFactory.Create(Guid.NewGuid(), "Shared", "User", "12345", "*****@*****.**"); var userContext = A.Fake <IUserContext>(); A.CallTo(() => userContext.UserId).Returns(Guid.Parse(ownerUser.Id)); context = new IwsContext(userContext, A.Fake <IEventDispatcher>()); authorization = A.Fake <INotificationApplicationAuthorization>(); repository = new SharedUserRepository(context, authorization); preRunNotifications = context.NotificationApplications.Select(na => na.Id).ToArray(); notification = NotificationApplicationFactory.Create(Guid.Parse(ownerUser.Id), NotificationType.Recovery, UKCompetentAuthority.England, 20191); context.Users.Add(ownerUser); context.Users.Add(sharedUser); context.NotificationApplications.Add(notification); context.SaveChanges(); }
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 void NotificationNumberFormat(string expected, string country, int notificationNumber) { var userId = new Guid("{FCCC2E8A-2464-4C10-8521-09F16F2C550C}"); var notificationApplication = new NotificationApplication(userId, NotificationType.Disposal, GetCompetentAuthority(country), notificationNumber); Assert.Equal(expected, notificationApplication.NotificationNumber); }
public MovementOperationReceiptTests() { var notification = new NotificationApplication(Guid.NewGuid(), NotificationType.Recovery, UKCompetentAuthority.England, 0); movement = new Movement(1, notification.Id); ObjectInstantiator<Movement>.SetProperty(x => x.Date, MovementDate, movement); ObjectInstantiator<Movement>.SetProperty(x => x.Units, ShipmentQuantityUnits.Kilograms, movement); }
private static IEnumerable <PackagingInfo> GetPackagingInfoFromDraft(IEnumerable <DraftPackagingInfo> draftPackagingInfos, NotificationApplication notification) { var packagingTypes = draftPackagingInfos.Select(p => p.PackagingType); return(notification.PackagingInfos .Where(p => packagingTypes.Contains(p.PackagingType))); }
public SpecialHandlingViewModel(NotificationApplication notification) { if (notification.HasSpecialHandlingRequirements.GetValueOrDefault()) { Requirements = "See Annex"; details = notification.SpecialHandlingDetails; } }
public SpecialHandlingViewModel(NotificationApplication notification) { if (notification.HasSpecialHandlingRequirements.GetValueOrDefault()) { Requirements = "See Annex"; details = notification.SpecialHandlingDetails; } }
public void CanAddPackagingInfo() { var notification = new NotificationApplication(Guid.NewGuid(), NotificationType.Recovery, UKCompetentAuthority.England, 0); notification.SetPackagingInfo(new[] { PackagingInfo.CreateOtherPackagingInfo("package description") }); Assert.Equal(1, notification.PackagingInfos.Count()); }
public void CanAddPackagingInfo() { var notification = new NotificationApplication(Guid.NewGuid(), NotificationType.Recovery, UKCompetentAuthority.England, 0); notification.SetPackagingInfo(new[] { PackagingInfo.CreateOtherPackagingInfo("package description") }); Assert.Equal(1, notification.PackagingInfos.Count()); }
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 void SetProvider_RaisesEvent() { var notification = new NotificationApplication(Guid.NewGuid(), NotificationType.Recovery, UKCompetentAuthority.England, 0); notification.SetWasteRecoveryInformationProvider(ProvidedBy.Importer); Assert.Equal(ProvidedBy.Importer, notification.Events.OfType<ProviderChangedEvent>().SingleOrDefault().NewProvider); }
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 async Task ReturnsCorrectFormat(string expected, UKCompetentAuthority competentAuthority, int notificationNumber, NotificationType notificationType, int movementNumber) { var notification = new NotificationApplication(Guid.NewGuid(), notificationType, competentAuthority, notificationNumber); A.CallTo(() => notificationRepository.GetById(notificationId)).Returns(notification); var result = await certificateOfRecoveryName.GetValue(new Movement(movementNumber, notificationId, AnyDate, userId)); Assert.Equal(expected, result); }
public void NotificationNumberFormat(string expected, string country, int notificationNumber) { var userId = new Guid("{FCCC2E8A-2464-4C10-8521-09F16F2C550C}"); var notificationApplication = new NotificationApplication(userId, NotificationType.Disposal, GetCompetentAuthority(country), notificationNumber); Assert.Equal(expected, notificationApplication.NotificationNumber); }
public GeneralViewModel(NotificationApplication notification, ShipmentInfo shipmentInfo, FacilityCollection facilityCollection, DateTimeFormatter dateTimeFormatter, QuantityFormatter quantityFormatter, PhysicalCharacteristicsFormatter physicalCharacteristicsFormatter) { Number = notification.NotificationNumber; IsDisposal = notification.NotificationType.Equals(NotificationType.Disposal); IsRecovery = notification.NotificationType.Equals(NotificationType.Recovery); var isPreconsented = facilityCollection.AllFacilitiesPreconsented; if (!isPreconsented.HasValue) { IsPreconsented = false; IsNotPreconsented = false; } else { IsPreconsented = isPreconsented.GetValueOrDefault(); IsNotPreconsented = !isPreconsented.GetValueOrDefault(); } if (shipmentInfo.NumberOfShipments > 1) { IsIndividualShipment = false; IsNotIndividualShipment = true; } else { IsIndividualShipment = true; IsNotIndividualShipment = false; } IntendedNumberOfShipments = shipmentInfo.NumberOfShipments.ToString(); FirstDeparture = dateTimeFormatter.DateTimeToDocumentFormatString(shipmentInfo.ShipmentPeriod.FirstDate); LastDeparture = dateTimeFormatter.DateTimeToDocumentFormatString(shipmentInfo.ShipmentPeriod.LastDate); SetIntendedQuantityFields(shipmentInfo, quantityFormatter); var hasSpecialHandlingRequirements = notification.HasSpecialHandlingRequirements; if (!hasSpecialHandlingRequirements.HasValue) { IsSpecialHandling = false; IsNotSpecialHandling = false; } else { IsSpecialHandling = hasSpecialHandlingRequirements.GetValueOrDefault(); IsNotSpecialHandling = !hasSpecialHandlingRequirements.GetValueOrDefault(); } PackagingTypes = GetPackagingInfo(notification); PhysicalCharacteristics = physicalCharacteristicsFormatter.PhysicalCharacteristicsToCommaDelimitedString( notification.PhysicalCharacteristics); }
public MovementOperationReceiptTests() { var notification = new NotificationApplication(Guid.NewGuid(), NotificationType.Recovery, UKCompetentAuthority.England, 0); movement = new Movement(1, notification.Id); ObjectInstantiator <Movement> .SetProperty(x => x.Date, MovementDate, movement); ObjectInstantiator <Movement> .SetProperty(x => x.Units, ShipmentQuantityUnits.Kilograms, movement); }
public void SetProvider_RaisesEvent() { var notification = new NotificationApplication(Guid.NewGuid(), NotificationType.Recovery, UKCompetentAuthority.England, 0); notification.SetWasteRecoveryInformationProvider(ProvidedBy.Importer); Assert.Equal(ProvidedBy.Importer, notification.Events.OfType <ProviderChangedEvent>().SingleOrDefault().NewProvider); }
public void CreateNotificationRaisesDomainEvent() { var notification = new NotificationApplication(Guid.Empty, NotificationType.Recovery, UKCompetentAuthority.England, 0); EntityHelper.SetEntityId(notification, notificationId); Assert.Equal(notification, notification.Events.OfType <NotificationCreatedEvent>().SingleOrDefault().Notification); }
public void CreateNotificationRaisesDomainEvent() { var notification = new NotificationApplication(Guid.Empty, NotificationType.Recovery, UKCompetentAuthority.England, 0); EntityHelper.SetEntityId(notification, notificationId); Assert.Equal(notification, notification.Events.OfType<NotificationCreatedEvent>().SingleOrDefault().Notification); }
public async Task ReturnsCorrectFormat(string expected, UKCompetentAuthority competentAuthority, int notificationNumber, NotificationType notificationType, int movementNumber) { var notification = new NotificationApplication(Guid.NewGuid(), notificationType, competentAuthority, notificationNumber); A.CallTo(() => notificationRepository.GetById(notificationId)).Returns(notification); var result = await certificateOfRecoveryName.GetValue(new Movement(movementNumber, notificationId, AnyDate, userId)); Assert.Equal(expected, result); }
private async Task CheckCompetentAuthority(NotificationApplication notification) { var userCompetentAuthority = await context.GetUsersCompetentAuthority(userContext); if (notification.CompetentAuthority != userCompetentAuthority) { throw new SecurityException(string.Format("Access denied to this notification {0} for user {1} for competent authority {2}", notification.Id, userContext.UserId, userCompetentAuthority)); } }
public WasteCompositionBlock(IList<MergeField> mergeFields, NotificationApplication notification) { CorrespondingMergeFields = MergeFieldLocator.GetCorrespondingFieldsForBlock(mergeFields, TypeName); data = new WasteCompositionViewModel(notification.WasteType, new WasteCompositionFormatter()); //Set annex merge fields AnnexMergeFields = MergeFieldLocator.GetAnnexMergeFields(mergeFields, TypeName); ((List<MergeField>)AnnexMergeFields).AddRange(MergeFieldLocator.GetAnnexMergeFields(mergeFields, Parameters)); ((List<MergeField>)AnnexMergeFields).AddRange(MergeFieldLocator.GetAnnexMergeFields(mergeFields, Constituents)); }
private async Task CheckCompetentAuthority(NotificationApplication notification) { var userCompetentAuthority = await context.GetUsersCompetentAuthority(userContext); if (notification.CompetentAuthority != userCompetentAuthority) { throw new SecurityException(string.Format("Access denied to this notification {0} for user {1} for competent authority {2}", notification.Id, userContext.UserId, userCompetentAuthority)); } }
public WasteCompositionBlock(IList <MergeField> mergeFields, NotificationApplication notification) { CorrespondingMergeFields = MergeFieldLocator.GetCorrespondingFieldsForBlock(mergeFields, TypeName); data = new WasteCompositionViewModel(notification.WasteType, new WasteCompositionFormatter()); //Set annex merge fields AnnexMergeFields = MergeFieldLocator.GetAnnexMergeFields(mergeFields, TypeName); ((List <MergeField>)AnnexMergeFields).AddRange(MergeFieldLocator.GetAnnexMergeFields(mergeFields, Parameters)); ((List <MergeField>)AnnexMergeFields).AddRange(MergeFieldLocator.GetAnnexMergeFields(mergeFields, Constituents)); }
public async Task ReturnsCorrectFormat(UKCompetentAuthority competentAuthority, int notificationNumber, int movementNumber, string expected) { var notification = new NotificationApplication(notificationId, NotificationType.Recovery, competentAuthority, notificationNumber); A.CallTo(() => notificationApplicationRepository.GetById(notificationId)).Returns(notification); var movement = new Movement(movementNumber, notificationId, AnyDate, userId); var name = await certificateOfReceiptName.GetValue(movement); Assert.Equal(expected, name); }
private async Task<WasteRecovery> CreateWasteRecovery(NotificationApplication notification) { var estimatedValue = new EstimatedValue(ValuePerWeightUnits.Kilogram, 10); var recoveryCost = new RecoveryCost(ValuePerWeightUnits.Tonne, 50); var wasteRecovery = new WasteRecovery(notification.Id, new Percentage(50), estimatedValue, recoveryCost); context.WasteRecoveries.Add(wasteRecovery); await context.SaveChangesAsync(); return wasteRecovery; }
public async Task ReturnsCorrectFormat(UKCompetentAuthority competentAuthority, int notificationNumber, int movementNumber, string expected) { var notification = new NotificationApplication(notificationId, NotificationType.Recovery, competentAuthority, notificationNumber); A.CallTo(() => notificationApplicationRepository.GetById(notificationId)).Returns(notification); var movement = new Movement(movementNumber, notificationId, AnyDate, userId); var name = await certificateOfReceiptName.GetValue(movement); Assert.Equal(expected, name); }
private void ClearOldCodes(SetBaselOecdCodeForNotification message, NotificationApplication notification) { if (message.CodeType == CodeType.Basel) { notification.RemoveCodeOfType(CodeType.Oecd); } else if (message.CodeType == CodeType.Oecd) { notification.RemoveCodeOfType(CodeType.Basel); } }
internal void MergeDataIntoDocument(IList<MergeField> mergeFields, NotificationApplication notification) { foreach (var mergeField in mergeFields) { mergeField.RemoveCurrentContents(); string value = notificationMergeMapper.GetValueForMergeField(mergeField, notification); mergeField.SetText(value); } }
public GeneralBlock(IList <MergeField> mergeFields, NotificationApplication notification, ShipmentInfo shipmentInfo, FacilityCollection facilityCollection) { CorrespondingMergeFields = MergeFieldLocator.GetCorrespondingFieldsForBlock(mergeFields, "General"); data = new GeneralViewModel(notification, shipmentInfo, facilityCollection, new DateTimeFormatter(), new QuantityFormatter(), new PhysicalCharacteristicsFormatter()); }
public GeneralBlock(IList<MergeField> mergeFields, NotificationApplication notification, ShipmentInfo shipmentInfo, FacilityCollection facilityCollection) { CorrespondingMergeFields = MergeFieldLocator.GetCorrespondingFieldsForBlock(mergeFields, "General"); data = new GeneralViewModel(notification, shipmentInfo, facilityCollection, new DateTimeFormatter(), new QuantityFormatter(), new PhysicalCharacteristicsFormatter()); }
public NotificationFacilityTests() { notification = new NotificationApplication(Guid.NewGuid(), NotificationType.Recovery, UKCompetentAuthority.England, 0); facilityCollection = new FacilityCollection(notification.Id); facility1 = facilityCollection.AddFacility(ObjectFactory.CreateEmptyBusiness(), ObjectFactory.CreateDefaultAddress(), ObjectFactory.CreateEmptyContact()); facility2 = facilityCollection.AddFacility(ObjectFactory.CreateEmptyBusiness(), ObjectFactory.CreateDefaultAddress(), ObjectFactory.CreateEmptyContact()); }
public NotificationFacilityTests() { notification = new NotificationApplication(Guid.NewGuid(), NotificationType.Recovery, UKCompetentAuthority.England, 0); facilityCollection = new FacilityCollection(notification.Id); facility1 = facilityCollection.AddFacility(ObjectFactory.CreateEmptyBusiness(), ObjectFactory.CreateDefaultAddress(), ObjectFactory.CreateEmptyContact()); facility2 = facilityCollection.AddFacility(ObjectFactory.CreateEmptyBusiness(), ObjectFactory.CreateDefaultAddress(), ObjectFactory.CreateEmptyContact()); }
public MovementTests() { var notification = new NotificationApplication( Guid.NewGuid(), NotificationType.Recovery, UKCompetentAuthority.England, 0); movement = new Movement(1, notification.Id, AnyDate, userId); SystemTime.Freeze(FrozenTime); }
public MovementTests() { var notification = new NotificationApplication( Guid.NewGuid(), NotificationType.Recovery, UKCompetentAuthority.England, 0); movement = new Movement(1, notification.Id, AnyDate, userId); SystemTime.Freeze(FrozenTime); }
private async Task <WasteRecovery> CreateWasteRecovery(NotificationApplication notification) { var estimatedValue = new EstimatedValue(ValuePerWeightUnits.Kilogram, 10); var recoveryCost = new RecoveryCost(ValuePerWeightUnits.Tonne, 50); var wasteRecovery = new WasteRecovery(notification.Id, new Percentage(50), estimatedValue, recoveryCost); context.WasteRecoveries.Add(wasteRecovery); await context.SaveChangesAsync(); return(wasteRecovery); }
public virtual void CopyNotificationProperties(NotificationApplication source, NotificationApplication destination) { // We want to set all properties except a few decided by business logic. typeof(NotificationApplication).GetProperty("NotificationNumber") .SetValue(source, destination.NotificationNumber, null); typeof(NotificationApplication).GetProperty("CompetentAuthority") .SetValue(source, destination.CompetentAuthority, null); typeof(NotificationApplication).GetProperty("NotificationType") .SetValue(source, destination.NotificationType, null); // This should not be needed however is a precaution to prevent overwriting the source data. typeof(Entity).GetProperty("Id").SetValue(source, Guid.Empty, null); }
public virtual void CopyNotificationProperties(NotificationApplication source, NotificationApplication destination) { // We want to set all properties except a few decided by business logic. typeof(NotificationApplication).GetProperty("NotificationNumber") .SetValue(source, destination.NotificationNumber, null); typeof(NotificationApplication).GetProperty("CompetentAuthority") .SetValue(source, destination.CompetentAuthority, null); typeof(NotificationApplication).GetProperty("NotificationType") .SetValue(source, destination.NotificationType, null); // This should not be needed however is a precaution to prevent overwriting the source data. typeof(Entity).GetProperty("Id").SetValue(source, Guid.Empty, null); }
public void CantAddRecoveryCodesToDisposalNotification() { var notification = new NotificationApplication(Guid.NewGuid(), NotificationType.Disposal, UKCompetentAuthority.England, 0); var codes = new List <OperationCode> { OperationCode.R1, OperationCode.R2 }; Action updateCodes = () => notification.SetOperationCodes(codes); Assert.Throws <InvalidOperationException>(updateCodes); }
public ProducerBlock(IList<MergeField> mergeFields, NotificationApplication notification, ProducerCollection producerCollection) { CorrespondingMergeFields = MergeFieldLocator.GetCorrespondingFieldsForBlock(mergeFields, TypeName); var numberOfProducers = producerCollection.Producers.Count(); var processText = notification.WasteGenerationProcess; var isProcessAnnexAttached = notification.IsWasteGenerationProcessAttached; data = producerCollection.Producers.Select(p => new ProducerViewModel(p, numberOfProducers, processText, isProcessAnnexAttached)).ToList(); // The producers annex contains a set of different merge fields for producer marked as Site of Export. AnnexMergeFields = MergeFieldLocator.GetAnnexMergeFields(mergeFields, TypeName); ((List<MergeField>)AnnexMergeFields).AddRange(MergeFieldLocator.GetAnnexMergeFields(mergeFields, SiteOfExport)); ((List<MergeField>)AnnexMergeFields).AddRange(MergeFieldLocator.GetAnnexMergeFields(mergeFields, PoGtext)); }
public void CantAddRecoveryCodesToDisposalNotification() { var notification = new NotificationApplication(Guid.NewGuid(), NotificationType.Disposal, UKCompetentAuthority.England, 0); var codes = new List<OperationCode> { OperationCode.R1, OperationCode.R2 }; Action updateCodes = () => notification.SetOperationCodes(codes); Assert.Throws<InvalidOperationException>(updateCodes); }
public void CopyWasteCodes(NotificationApplication source, NotificationApplication destination) { var clone = new NotificationApplicationClone(source, destination); CopyBaselOecdCode(clone); CopyCustomsCode(clone); CopyExportCode(clone); CopyImportCode(clone); CopyOtherCode(clone); CopyEwcCodes(clone); CopyUnClasses(clone); CopyUnNumbers(clone); CopyYCodes(clone); CopyHCodes(clone); }