Пример #1
0
        public void CanAddWasteTypeForRdf()
        {
            notification.SetWasteType(WasteType.CreateRdfWasteType(GetWasteAdditionalInformationCollection()));

            Assert.True(notification.HasWasteType);
            Assert.Equal(5, notification.WasteType.WasteAdditionalInformation.Count());
        }
Пример #2
0
        public static NotificationApplication CreateCompleted(Guid id,
                                                              Guid userId,
                                                              IList <Country> countries,
                                                              IList <WasteCode> wasteCodes,
                                                              int number = 250)
        {
            var notification = Create(id, number);

            OI.SetProperty(x => x.UserId, userId, notification);

            notification.SetPhysicalCharacteristics(new List <PhysicalCharacteristicsInfo>
            {
                PhysicalCharacteristicsInfo.CreatePhysicalCharacteristicsInfo(PhysicalCharacteristicType.Sludgy)
            });

            notification.SetWasteType(WasteType.CreateRdfWasteType(new[]
            {
                WasteAdditionalInformation.CreateWasteAdditionalInformation("boulder", 5, 10, WasteInformationType.Energy),
                WasteAdditionalInformation.CreateWasteAdditionalInformation("notes", 6, 9, WasteInformationType.AshContent)
            }));

            SetWasteCodes(notification, wasteCodes);

            SetProperty("WasteAdditionalInformationCollection", new List <WasteAdditionalInformation>(),
                        notification.WasteType);
            notification.SetWasteAdditionalInformation(new[]
            {
                WasteAdditionalInformation.CreateWasteAdditionalInformation("Rubik's cubes", 1, 10,
                                                                            WasteInformationType.AshContent)
            });

            notification.SetOperationCodes(new[] { OperationCode.R1, OperationCode.R7 });
            notification.ReasonForExport = "recovery";

            return(notification);
        }
        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);
        }
 private IEnumerable <NotificationApplication> GetNotificationApplications()
 {
     return(new[]
     {
         CreateNotificationApplication(notification1, UKCompetentAuthority.England, WasteType.CreateRdfWasteType(null)),
         CreateNotificationApplication(notification2, UKCompetentAuthority.England, WasteType.CreateRdfWasteType(null)),
         CreateNotificationApplication(notification3, UKCompetentAuthority.England, WasteType.CreateSrfWasteType(null)),
         CreateNotificationApplication(notification4, UKCompetentAuthority.England, WasteType.CreateWoodWasteType(null, null)),
         CreateNotificationApplication(notification5, UKCompetentAuthority.England, WasteType.CreateWoodWasteType(null, null)),
         CreateNotificationApplication(notification6, UKCompetentAuthority.England, WasteType.CreateWoodWasteType(null, null)),
         CreateNotificationApplication(notification7, UKCompetentAuthority.Scotland, WasteType.CreateWoodWasteType(null, null))
     });
 }
Пример #5
0
        public void CanAddWasteTypeForOther()
        {
            notification.SetWasteType(WasteType.CreateRdfWasteType(GetWasteAdditionalInformationCollection()));

            Assert.True(notification.HasWasteType);
        }
Пример #6
0
 public void CanAddWasteTypeForRdfWithoutComposition()
 {
     notification.SetWasteType(WasteType.CreateRdfWasteType(null));
     Assert.NotNull(notification.WasteType);
 }