Exemple #1
0
 public void EwcCodeNull_Throws()
 {
     Assert.Throws <ArgumentNullException>(() => new WasteType(ImportNotificationId,
                                                               "WasteTypeName",
                                                               BaselOecdCode.CreateNotListed(),
                                                               null,
                                                               YCode.CreateNotApplicable(),
                                                               HCode.CreateNotApplicable(),
                                                               UnClass.CreateNotApplicable(),
                                                               ChemicalComposition.Other));
 }
Exemple #2
0
        public void UnClassNotApplicable_NotApplicableTrue()
        {
            var wasteType = new WasteType(ImportNotificationId,
                                          "WasteTypeName",
                                          BaselOecdCode.CreateNotListed(),
                                          EwcCode.CreateFor(new[] { AnyWasteCode(CodeType.Ewc) }),
                                          YCode.CreateNotApplicable(),
                                          HCode.CreateNotApplicable(),
                                          UnClass.CreateNotApplicable(),
                                          ChemicalComposition.Other);

            Assert.True(wasteType.UnClassNotApplicable);
        }
Exemple #3
0
 public void UnsetChemicalComposition_Throws()
 {
     Assert.Throws <ArgumentException>(() => new WasteType(ImportNotificationId,
                                                           "Name",
                                                           BaselOecdCode.CreateNotListed(),
                                                           EwcCode.CreateFor(new[]
     {
         AnyWasteCode(CodeType.Ewc)
     }),
                                                           YCode.CreateNotApplicable(),
                                                           HCode.CreateNotApplicable(),
                                                           UnClass.CreateNotApplicable(),
                                                           default(ChemicalComposition)));
 }
Exemple #4
0
 public void UnClassNull_Throws()
 {
     Assert.Throws <ArgumentNullException>(() => new WasteType(ImportNotificationId,
                                                               "WasteTypeName",
                                                               BaselOecdCode.CreateNotListed(),
                                                               EwcCode.CreateFor(new[]
     {
         AnyWasteCode(CodeType.Ewc)
     }),
                                                               YCode.CreateNotApplicable(),
                                                               HCode.CreateNotApplicable(),
                                                               null,
                                                               ChemicalComposition.Other));
 }
Exemple #5
0
 public void ImportNotificationIdDefaultValue_Throws()
 {
     Assert.Throws <ArgumentException>(() => new WasteType(Guid.Empty,
                                                           "WasteTypeName",
                                                           BaselOecdCode.CreateNotListed(),
                                                           EwcCode.CreateFor(new[]
     {
         AnyWasteCode(CodeType.Ewc)
     }),
                                                           YCode.CreateNotApplicable(),
                                                           HCode.CreateNotApplicable(),
                                                           UnClass.CreateNotApplicable(),
                                                           ChemicalComposition.Other));
 }
Exemple #6
0
        private BaselOecdCode CreateBaselCode(bool notListed, Guid?codeId)
        {
            if (notListed)
            {
                return(BaselOecdCode.CreateNotListed());
            }

            if (!codeId.HasValue)
            {
                throw new ArgumentNullException("codeId must not be null when basel/oecd code isn't 'not listed'");
            }

            var wasteCode = Task.Run(() => wasteCodeRepository.GetWasteCodesByIds(new[] { codeId.Value })).Result.Single();

            return(BaselOecdCode.CreateFor(wasteCode));
        }
Exemple #7
0
        public void UnClassesAreSet()
        {
            var unCode   = AnyWasteCode(CodeType.Un);
            var unCodeId = new Guid("4B50E7AA-0136-444A-9185-FE31BE6CF98E");

            ObjectInstantiator <WasteCode> .SetProperty(x => x.Id, unCodeId, unCode);

            var wasteType = new WasteType(ImportNotificationId,
                                          "WateTypeName",
                                          BaselOecdCode.CreateNotListed(),
                                          EwcCode.CreateFor(new[] { AnyWasteCode(CodeType.Ewc) }),
                                          YCode.CreateNotApplicable(),
                                          HCode.CreateNotApplicable(),
                                          UnClass.CreateFor(new[] { unCode }),
                                          ChemicalComposition.Other);

            Assert.Equal(1, wasteType.WasteCodes.Count(wc => wc.WasteCodeId == unCodeId));
        }
Exemple #8
0
        public void HCodesAreSet()
        {
            var hCode   = AnyWasteCode(CodeType.H);
            var hCodeId = new Guid("B21D8610-EBB0-436F-BD26-D2F40B42B866");

            ObjectInstantiator <WasteCode> .SetProperty(x => x.Id, hCodeId, hCode);

            var wasteType = new WasteType(ImportNotificationId,
                                          "WateTypeName",
                                          BaselOecdCode.CreateNotListed(),
                                          EwcCode.CreateFor(new[] { AnyWasteCode(CodeType.Ewc) }),
                                          YCode.CreateNotApplicable(),
                                          HCode.CreateFor(new[] { hCode }),
                                          UnClass.CreateNotApplicable(),
                                          ChemicalComposition.Other);

            Assert.Equal(1, wasteType.WasteCodes.Count(wc => wc.WasteCodeId == hCodeId));
        }
Exemple #9
0
        public void YCodesAreSet()
        {
            var yCode   = AnyWasteCode(CodeType.Y);
            var yCodeId = new Guid("F416BD1D-56E9-45D8-9A4E-7476DF201AB2");

            ObjectInstantiator <WasteCode> .SetProperty(x => x.Id, yCodeId, yCode);

            var wasteType = new WasteType(ImportNotificationId,
                                          "WateTypeName",
                                          BaselOecdCode.CreateNotListed(),
                                          EwcCode.CreateFor(new[] { AnyWasteCode(CodeType.Ewc) }),
                                          YCode.CreateFor(new[] { yCode }),
                                          HCode.CreateNotApplicable(),
                                          UnClass.CreateNotApplicable(),
                                          ChemicalComposition.Other);

            Assert.Equal(1, wasteType.WasteCodes.Count(wc => wc.WasteCodeId == yCodeId));
        }
Exemple #10
0
        public void EwcCodesAreSet()
        {
            var ewcCode   = AnyWasteCode(CodeType.Ewc);
            var ewcCodeId = new Guid("A4DA3323-B6BD-4245-B144-B9E05661BEC6");

            ObjectInstantiator <WasteCode> .SetProperty(x => x.Id, ewcCodeId, ewcCode);

            var wasteType = new WasteType(ImportNotificationId,
                                          "WateTypeName",
                                          BaselOecdCode.CreateNotListed(),
                                          EwcCode.CreateFor(new[] { ewcCode }),
                                          YCode.CreateNotApplicable(),
                                          HCode.CreateNotApplicable(),
                                          UnClass.CreateNotApplicable(),
                                          ChemicalComposition.Other);

            Assert.Equal(1, wasteType.WasteCodes.Count(wc => wc.WasteCodeId == ewcCodeId));
        }