// constraints are not passed down from collection attributes public override string Format(FormatContext context, BareANY hl7Value, int indentLevel) { if (hl7Value == null) { return(string.Empty); } ICollection <BareANY> bareAnyCollection = GenericClassUtil.ConvertToBareANYCollection(hl7Value); HandleConstraints(GetSubType(context), context.GetConstraints(), hl7Value, bareAnyCollection, context); return(base.Format(context, hl7Value, indentLevel)); }
public virtual void TestConvertToBareANYCollectionType() { var first = new CodedTypeR2 <UnitsOfMeasureCaseSensitive>(Ca.Infoway.Messagebuilder.Domainvalue.Basic.UnitsOfMeasureCaseSensitive.CUP); var second = new CodedTypeR2 <UnitsOfMeasureCaseSensitive>(Ca.Infoway.Messagebuilder.Domainvalue.Basic.UnitsOfMeasureCaseSensitive.DECALITRE); var third = new CodedTypeR2 <UnitsOfMeasureCaseSensitive>(Ca.Infoway.Messagebuilder.Domainvalue.Basic.UnitsOfMeasureCaseSensitive.GALLON); LIST <CD_R2 <UnitsOfMeasureCaseSensitive>, CodedTypeR2 <UnitsOfMeasureCaseSensitive> > list = new LISTImpl <CD_R2 <UnitsOfMeasureCaseSensitive>, CodedTypeR2 <UnitsOfMeasureCaseSensitive> >(typeof(CD_R2Impl <UnitsOfMeasureCaseSensitive>)); list.RawList().Add(first); list.RawList().Add(second); list.RawList().Add(third); ICollection <BareANY> bareANYCollection = GenericClassUtil.ConvertToBareANYCollection(list); IEnumerator <BareANY> enumerator = bareANYCollection.GetEnumerator(); enumerator.MoveNext(); Assert.AreSame(first, enumerator.Current.BareValue); enumerator.MoveNext(); Assert.AreSame(second, enumerator.Current.BareValue); enumerator.MoveNext(); Assert.AreSame(third, enumerator.Current.BareValue); }
public virtual void TestConvertToBareANYNonCollectionType() { CD_R2 <UnitsOfMeasureCaseSensitive> anyValue = CreateCDR2Instance(); Assert.IsNull(GenericClassUtil.ConvertToBareANYCollection(anyValue)); }
public virtual void TestConvertToBareANYNullValue() { Assert.IsNull(GenericClassUtil.ConvertToBareANYCollection(null)); }