private HCode CreateHCode(bool notApplicable, IEnumerable <Guid> codeIds) { if (notApplicable) { return(HCode.CreateNotApplicable()); } var wasteCodes = Task.Run(() => wasteCodeRepository.GetWasteCodesByIds(codeIds)).Result; return(HCode.CreateFor(wasteCodes)); }
public void CanCreateWasteType() { var wasteType = new WasteType(ImportNotificationId, "WasteTypeName", BaselOecdCode.CreateFor(AnyWasteCode(CodeType.Basel)), EwcCode.CreateFor(new[] { AnyWasteCode(CodeType.Ewc) }), YCode.CreateFor(new[] { AnyWasteCode(CodeType.Y) }), HCode.CreateFor(new[] { AnyWasteCode(CodeType.H) }), UnClass.CreateFor(new[] { AnyWasteCode(CodeType.Un) }), ChemicalComposition.Other); Assert.IsType <WasteType>(wasteType); }
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)); }
public void AnyHCodesWrongType_Throws(CodeType codeType) { Assert.Throws <ArgumentException>(() => HCode.CreateFor(new[] { AnyWasteCode(codeType) })); }
public void HCode_CreateFor_Null_Throws() { Assert.Throws <ArgumentNullException>(() => HCode.CreateFor(null)); }