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); }
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)); }
public void OecdCodeIsSet() { var oecdCode = AnyWasteCode(CodeType.Oecd); var oecdCodeId = new Guid("A58E7CE8-FA46-4E35-A3ED-26E395678CA0"); ObjectInstantiator <WasteCode> .SetProperty(x => x.Id, oecdCodeId, oecdCode); var wasteType = new WasteType(ImportNotificationId, "WasteTypeName", BaselOecdCode.CreateFor(oecdCode), EwcCode.CreateFor(new[] { AnyWasteCode(CodeType.Ewc) }), YCode.CreateNotApplicable(), HCode.CreateNotApplicable(), UnClass.CreateNotApplicable(), ChemicalComposition.Other); Assert.Equal(1, wasteType.WasteCodes.Count(wc => wc.WasteCodeId == oecdCodeId)); }
public void BaselCodeIsSet() { var baselCode = AnyWasteCode(CodeType.Basel); var baselCodeId = new Guid("72669DEE-1126-47B3-8C45-2395F54C82D8"); ObjectInstantiator <WasteCode> .SetProperty(x => x.Id, baselCodeId, baselCode); var wasteType = new WasteType(ImportNotificationId, "WasteTypeName", BaselOecdCode.CreateFor(baselCode), EwcCode.CreateFor(new[] { AnyWasteCode(CodeType.Ewc) }), YCode.CreateNotApplicable(), HCode.CreateNotApplicable(), UnClass.CreateNotApplicable(), ChemicalComposition.Other); Assert.Equal(1, wasteType.WasteCodes.Count(wc => wc.WasteCodeId == baselCodeId)); }
public void BaselOecdCode_CreateFor_Null_Throws() { Assert.Throws <ArgumentNullException>(() => BaselOecdCode.CreateFor(null)); }
public void BaselCodeTypeNotBaselOecd_Throws(CodeType codeType) { Assert.Throws <ArgumentException>(() => BaselOecdCode.CreateFor(AnyWasteCode(codeType))); }