private void HandleQualifier(XmlElement element, CodedTypeR2 <Code> codedType, ParseContext context, XmlToModelResult result ) { if (QualifierAllowed()) { ParseContext newContext = ParseContextImpl.Create("CR", typeof(Code), context); XmlNodeList qualifiers = element.GetElementsByTagName("qualifier"); for (int i = 0, length = qualifiers.Count; i < length; i++) { XmlElement qualifierElement = (XmlElement)qualifiers.Item(i); // only want direct child node qualifiers if (qualifierElement.ParentNode.Equals(element)) { BareANY anyCr = new CrR2ElementParser().Parse(newContext, qualifierElement, result); if (anyCr != null && anyCr.BareValue != null) { codedType.Qualifier.Add((CodeRole)anyCr.BareValue); } } } } else { ValidateUnallowedChildNode(context.Type, element, result, "qualifier"); } }
private void HandleConstraints(CodedTypeR2 <Code> codedType, ConstrainedDatatype constraints, XmlElement element, Hl7Errors errors) { ErrorLogger logger = new _ErrorLogger_127(errors, element); this.constraintsHandler.HandleConstraints(constraints, codedType, logger); }
private void HandleCodeAndCodeSystem(XmlElement element, CodedTypeR2 <Code> codedType, ParseContext context, XmlToModelResult result) { string code = GetAttributeValue(element, STANDARD_CODE_ATTRIBUTE_NAME); string codeSystem = null; if (element.HasAttribute(CODE_SYSTEM_ATTRIBUTE_NAME)) { if (CodeSystemAllowed()) { codeSystem = StringUtils.TrimToNull(GetAttributeValue(element, CODE_SYSTEM_ATTRIBUTE_NAME)); } else { LogValueNotAllowed(CODE_SYSTEM_ATTRIBUTE_NAME, element, context, result); } } //MBR-335: In some cases we have fixed values that are not part of the generated API and that have //values that do not conform to the expected return type. In this case, just fake up a value as //it will be discarded later in HL7SourceMapper. See PolicyActivity.GuarantorPerformerAssignedEntity //in ccda r1_1 message set for an example. i.e. GUAR is not a valid RoleClass bool relaxCodeCheck = context.IsFixedValue(); Code actualCode = this.codeLookupUtils.GetCorrespondingCode(code, codeSystem, context.GetExpectedReturnType(), element, context .Type, result, true, relaxCodeCheck); codedType.Code = actualCode; }
public static object ConvertCodedTypeR2(CodedTypeR2 <Code> source, Type parameterType) { if (source == null) { return(null); } Type codedType = typeof(CodedTypeR2 <>); Type baseCodeType = typeof(Code); Type genericType; if (!baseCodeType.IsAssignableFrom(parameterType)) { genericType = codedType.MakeGenericType(baseCodeType); } else { genericType = codedType.MakeGenericType(parameterType); } object result = Activator.CreateInstance(genericType); genericType.GetProperty("Code").SetValue(result, source.Code, null); genericType.GetProperty("CodeSystemName").SetValue(result, source.CodeSystemName, null); genericType.GetProperty("CodeSystemVersion").SetValue(result, source.CodeSystemVersion, null); genericType.GetProperty("DisplayName").SetValue(result, source.DisplayName, null); genericType.GetProperty("NullFlavorForTranslationOnly").SetValue(result, source.NullFlavorForTranslationOnly, null); genericType.GetProperty("OriginalText").SetValue(result, source.OriginalText, null); genericType.GetProperty("Qualifier").SetValue(result, source.Qualifier, null); genericType.GetProperty("Translation").SetValue(result, source.Translation, null); genericType.GetProperty("SimpleValue").SetValue(result, source.SimpleValue, null); genericType.GetProperty("Operator").SetValue(result, source.Operator, null); genericType.GetProperty("Value").SetValue(result, source.Value, null); genericType.GetProperty("ValidTime").SetValue(result, source.ValidTime, null); genericType.GetProperty("Qty").SetValue(result, source.Qty, null); return(result); }
public virtual void TestValidFull() { Interval <PlatformDate> interval = IntervalFactory.CreateLowHigh <PlatformDate>(new DateWithPattern(DateUtil.GetDate(2006, 11, 25), "yyyyMMdd"), new DateWithPattern(DateUtil.GetDate(2007, 0, 2), "yyyyMMdd")); CodedTypeR2 <Code> translation1 = new CodedTypeR2 <Code>(); translation1.Code = CeRxDomainTestValues.KILOGRAM; CodedTypeR2 <Code> translation2 = new CodedTypeR2 <Code>(); translation2.Code = CeRxDomainTestValues.FLUID_OUNCE; CodedTypeR2 <Code> codedType = new CodedTypeR2 <Code>(); codedType.Code = CeRxDomainTestValues.CENTIMETRE; codedType.CodeSystemName = "aCodeSystemName"; codedType.CodeSystemVersion = "aCodeSystemVersion"; codedType.DisplayName = "aDisplayName"; codedType.Translation.Add(translation1); codedType.Translation.Add(translation2); codedType.ValidTime = interval; EncapsulatedData originalText = new EncapsulatedData(); originalText.Content = "some original text"; codedType.OriginalText = originalText; string result = new HxitCeR2PropertyFormatter().Format(GetContext("name", "HXIT<CE>"), new CE_R2Impl <Code>(codedType)); Assert.IsTrue(this.result.IsValid()); AssertXml("result", "<name code=\"cm\" codeSystem=\"1.2.3.4\" codeSystemName=\"aCodeSystemName\" codeSystemVersion=\"aCodeSystemVersion\" displayName=\"aDisplayName\">" + "<originalText>some original text</originalText>" + "<translation code=\"kg\" codeSystem=\"1.2.3.4\"/>" + "<translation code=\"[foz_br]\" codeSystem=\"1.2.3.4\"/>" + "<validTime><low value=\"20061225\"/><high value=\"20070102\"/></validTime>" + "</name>", StringUtils.Trim(result), true ); }
public virtual void TestGetCodeValidArgument() { CodedTypeR2 <UnitsOfMeasureCaseSensitive> codedType = new CodedTypeR2 <UnitsOfMeasureCaseSensitive>(); codedType.Code = Ca.Infoway.Messagebuilder.Domainvalue.Basic.UnitsOfMeasureCaseSensitive.CUP; Assert.AreEqual(codedType.Code, CodedTypeR2Helper.GetCode(codedType)); }
private void HandleOriginalText(XmlElement element, CodedTypeR2 <Code> codedType, ParseContext context, XmlToModelResult result ) { if (OriginalTextAllowed()) { IList <XmlElement> originalTextElements = GetNamedElements("originalText", element); if (originalTextElements.Count > 0) { if (originalTextElements.Count > 1) { RecordError("Only one original text element is allowed.", element, context, result); } ParseContext newContext = ParseContextImpl.Create("ED", context); BareANY parsedOriginalText = this.edParser.Parse(newContext, originalTextElements[0], result); if (parsedOriginalText != null) { codedType.OriginalText = (EncapsulatedData)parsedOriginalText.BareValue; } } } else { ValidateUnallowedChildNode(context.Type, element, result, "originalText"); } }
public virtual void TestFormatPhysicalQuantityValidWithTranslations() { CodedTypeR2 <Code> translation1 = new CodedTypeR2 <Code>(); translation1.Code = Ca.Infoway.Messagebuilder.Domainvalue.Payload.AdministrativeGender.MALE; CodedTypeR2 <Code> translation2 = new CodedTypeR2 <Code>(); translation2.Code = Ca.Infoway.Messagebuilder.Domainvalue.Controlact.ActStatus.ACTIVE; string quantity = "33.45"; Ca.Infoway.Messagebuilder.Domainvalue.UnitsOfMeasureCaseSensitive unit = CeRxDomainTestValues.ENZYME_UNIT_MICROMOLES_MINUTE_PER_LITRE; PhysicalQuantity physicalQuantity = new PhysicalQuantity(); physicalQuantity.Quantity = new BigDecimal(quantity); physicalQuantity.Unit = unit; physicalQuantity.Translation.Add(translation1); physicalQuantity.Translation.Add(translation2); IDictionary <string, string> result = new PqR2PropertyFormatterTest.TestablePqR2PropertyFormatter().GetAttributeNameValuePairsForTest (CreateContext("PQ"), physicalQuantity, null); Assert.AreEqual(2, result.Count, "map size"); Assert.IsTrue(result.ContainsKey("value"), "key as expected"); Assert.AreEqual(quantity, result.SafeGet("value"), "value"); Assert.IsTrue(result.ContainsKey("unit"), "unit key as expected"); Assert.AreEqual(unit.CodeValue, result.SafeGet("unit"), "unit"); string xml = new PqR2PropertyFormatterTest.TestablePqR2PropertyFormatter().Format(CreateContext("PQ"), new PQImpl(physicalQuantity ), 0); AssertXml("should see translations", "<name unit=\"U/L\" value=\"33.45\"><translation code=\"M\" codeSystem=\"2.16.840.1.113883.5.1\" displayName=\"Male\"/><translation code=\"active\" codeSystem=\"2.16.840.1.113883.5.14\" displayName=\"Active\"/></name>" , xml); }
public virtual void TestEverythingSpecified() { CodedTypeR2 <Code> codedType = new CodedTypeR2 <Code>(); codedType.Code = CeRxDomainTestValues.CENTIMETRE; codedType.CodeSystemName = "aCodeSystemName"; codedType.CodeSystemVersion = "aCodeSystemVersion"; codedType.DisplayName = "aDisplayName"; codedType.SimpleValue = "simpleValue"; codedType.Operator = SetOperator.CONVEX_HULL; codedType.Value = BigDecimal.ONE; codedType.Translation.Add(new CodedTypeR2 <Code>()); codedType.Qualifier.Add(new CodeRole()); EncapsulatedData originalText = new EncapsulatedData(); originalText.Content = "some original text"; codedType.OriginalText = originalText; CV_R2 <Code> cv = new CV_R2Impl <Code>(codedType); string result = new CvR2PropertyFormatter().Format(GetContext("name", "CV"), cv); Assert.IsFalse(this.result.IsValid()); Assert.AreEqual(5, this.result.GetHl7Errors().Count); AssertXml("result", "<name code=\"cm\" codeSystem=\"1.2.3.4\" codeSystemName=\"aCodeSystemName\" codeSystemVersion=\"aCodeSystemVersion\" displayName=\"aDisplayName\"><originalText>some original text</originalText></name>" , StringUtils.Trim(result), true); }
public virtual void TestEverythingSpecified() { CodedTypeR2 <Code> codedType = new CodedTypeR2 <Code>(); codedType.Code = CeRxDomainTestValues.CENTIMETRE; codedType.CodeSystemName = "aCodeSystemName"; // Doesn't appear in the output, but shouldn't log an error either codedType.CodeSystemVersion = "aCodeSystemVersion"; codedType.DisplayName = "aDisplayName"; // Doesn't appear in the output, but shouldn't log an error either codedType.SimpleValue = "simpleValue"; codedType.Operator = SetOperator.CONVEX_HULL; codedType.Value = BigDecimal.ONE; codedType.Translation.Add(new CodedTypeR2 <Code>()); codedType.Qualifier.Add(new CodeRole()); EncapsulatedData originalText = new EncapsulatedData(); originalText.Content = "original text not allowed for CS"; codedType.OriginalText = originalText; CS_R2 <Code> cs = new CS_R2Impl <Code>(codedType); string result = new CsR2PropertyFormatter().Format(GetContext("name", "CS"), cs); Assert.IsFalse(this.result.IsValid()); Assert.AreEqual(7, this.result.GetHl7Errors().Count); Assert.AreEqual("<name code=\"cm\"/>", StringUtils.Trim(result), "result"); }
public virtual void TestValidFull() { CodedTypeR2 <Code> translation1 = new CodedTypeR2 <Code>(); translation1.Code = CeRxDomainTestValues.KILOGRAM; CodedTypeR2 <Code> translation2 = new CodedTypeR2 <Code>(); translation2.Code = CeRxDomainTestValues.FLUID_OUNCE; CodedTypeR2 <Code> translation3 = new CodedTypeR2 <Code>(); translation3.Code = new _Code_62(); translation3.NullFlavorForTranslationOnly = Ca.Infoway.Messagebuilder.Domainvalue.Nullflavor.NullFlavor.OTHER; CodedTypeR2 <Code> codedType = new CodedTypeR2 <Code>(); codedType.Code = CeRxDomainTestValues.CENTIMETRE; codedType.CodeSystemName = "aCodeSystemName"; codedType.CodeSystemVersion = "aCodeSystemVersion"; codedType.DisplayName = "aDisplayName"; codedType.Translation.Add(translation1); codedType.Translation.Add(translation2); codedType.Translation.Add(translation3); EncapsulatedData originalText = new EncapsulatedData(); originalText.Content = "some original text"; codedType.OriginalText = originalText; string result = new CeR2PropertyFormatter().Format(GetContext("name", "CE"), new CE_R2Impl <Code>(codedType)); Assert.IsTrue(this.result.IsValid()); AssertXml("result", "<name code=\"cm\" codeSystem=\"1.2.3.4\" codeSystemName=\"aCodeSystemName\" codeSystemVersion=\"aCodeSystemVersion\" displayName=\"aDisplayName\">" + "<originalText>some original text</originalText>" + "<translation code=\"kg\" codeSystem=\"1.2.3.4\"/>" + "<translation code=\"[foz_br]\" codeSystem=\"1.2.3.4\"/>" + "<translation codeSystem=\"1.2.3.4\" nullFlavor=\"OTH\"/>" + "</name>", StringUtils.Trim(result), true); }
public override BareANY Parse(ParseContext context, XmlNode node, XmlToModelResult result) { BareANY codedTypeAny = DoCreateR2DataTypeInstance(context); XmlElement element = (XmlElement)node; CodedTypeR2 <Code> codedType = new CodedTypeR2 <Code>(); // attributes HandleNullFlavor(element, codedTypeAny, context, result); HandleCodeAndCodeSystem(element, codedType, context, result); HandleCodeSystemName(element, codedType, context, result); HandleCodeSystemVersion(element, codedType, context, result); HandleDisplayName(element, codedType, context, result); HandleValue(element, codedType, context, result); HandleQty(element, codedType, context, result); HandleOperator(element, codedTypeAny, codedType, context, result); // elements HandleSimpleValue(element, codedType, context, result); HandleOriginalText(element, codedType, context, result); HandleQualifier(element, codedType, context, result); HandleTranslation(element, codedType, context, result); HandleValidTime(element, codedType, context, result); HandleConstraints(codedType, context.GetConstraints(), element, result); // want to return null if no attributes or elements are present if (codedType.IsEmpty()) { codedType = null; } ((BareANYImpl)codedTypeAny).BareValue = CodedTypeR2Helper.ConvertCodedTypeR2(codedType, context.GetExpectedReturnType()); return(codedTypeAny); }
private void HandleTranslation(XmlElement element, CodedTypeR2 <Code> codedType, ParseContext context, XmlToModelResult result ) { if (TranslationAllowed()) { // we have no knowledge of what domain the translation may belong to (I imagine code system could allow for a reverse lookup at some point) ParseContext newContext = ParseContextImpl.Create("CD", typeof(Code), context); XmlNodeList translations = element.GetElementsByTagName("translation"); for (int i = 0, length = translations.Count; i < length; i++) { XmlElement translationElement = (XmlElement)translations.Item(i); // only want direct child node translations if (translationElement.ParentNode.Equals(element)) { CodedTypeR2 <Code> parsedTranslation = ParseTranslation(translationElement, newContext, result); if (parsedTranslation != null) { codedType.Translation.Add(parsedTranslation); } } } } else { ValidateUnallowedChildNode(context.Type, element, result, "translation"); } }
private void HandleConstraints(CodedTypeR2 <Code> codedType, ConstrainedDatatype constraints, string propertyPath, Hl7Errors errors) { ErrorLogger logger = new _ErrorLogger_109(errors, propertyPath); this.constraintsHandler.HandleConstraints(constraints, codedType, logger); }
private string FormatValue(FormatContext context, CodedTypeR2 <Code> value, int indentLevel) { FormatContext newContext = new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl("CD", Ca.Infoway.Messagebuilder.Xml.ConformanceLevel .OPTIONAL, Cardinality.Create("0-1"), "value", context); return(this.cdFormatter.Format(newContext, new CD_R2Impl <Code>(value), indentLevel)); }
public virtual void TestPassingConstraints() { CodedTypeR2 <Code> codedType = CreateCodedType(); ConstrainedDatatype constraints = CreateConstraints(true); this.constraintsHandler.HandleConstraints(constraints, codedType, this.errorLogger); Assert.IsTrue(this.errors.IsEmpty()); }
private void HandleConstraints(Code code, ConstrainedDatatype constraints, XmlElement element, Hl7Errors errors) { // only code/codeSystem passed to constraints handler for now (only qualifier and codeSystem are currently checked for constraints) CodedTypeR2 <Code> codedType = new CodedTypeR2 <Code>(code); ErrorLogger logger = new _ErrorLogger_79(errors, element); this.constraintsHandler.HandleConstraints(constraints, codedType, logger); }
private bool HasChildContent(CodedTypeR2 <Code> codedType, FormatContext context) { bool hasChildContent = (OriginalTextAllowed() && HasOriginalText(codedType)); hasChildContent |= (QualifierAllowed() && HasQualifier(codedType)); hasChildContent |= (TranslationAllowed() && HasTranslation(codedType)); hasChildContent |= (ValidTimeAllowed() && HasValidTime(codedType)); return(hasChildContent); }
public virtual void TestMissingQualifierPassesWhenQualifier0To1() { ConstrainedDatatype constraints = CreateConstraints(false); CodedTypeR2 <Code> codedType = CreateCodedType(); codedType.Qualifier.Clear(); this.constraintsHandler.HandleConstraints(constraints, codedType, this.errorLogger); Assert.IsTrue(this.errors.IsEmpty()); }
private void CreateChildContent(CodedTypeR2 <Code> codedType, FormatContext context, int indentLevel, StringBuilder result ) { HandleOriginalText(codedType, indentLevel, result, context); HandleQualifier(codedType, indentLevel, result, context); HandleTranslation(codedType, indentLevel, result, context); HandleValidTime(codedType, indentLevel, result, context); HandleSimpleValue(codedType, result, context); }
private void HandleOperator(XmlElement element, BareANY codedTypeAny, CodedTypeR2 <Code> codedType, ParseContext context, XmlToModelResult result) { // the operator is specified as defaulting to "I", but let's only allow process the attribute when not a nullFlavor (or if operator has been explicitly provided) if (element.HasAttribute("operator") || codedTypeAny.NullFlavor == null) { SetOperator @operator = this.operatorHelper.HandleOperator(element, context, result, new ANYImpl <object>()); codedType.Operator = @operator; } }
public virtual void TestValidFull() { CodedTypeR2 <Code> codedType = new CodedTypeR2 <Code>(); codedType.Code = CeRxDomainTestValues.CENTIMETRE; string result = new CsR2PropertyFormatter().Format(GetContext("name", "CS"), new CS_R2Impl <Code>(codedType)); Assert.IsTrue(this.result.IsValid()); Assert.AreEqual("<name code=\"cm\"/>", StringUtils.Trim(result), "result"); }
public virtual void TestMissingQualifierNameCodeAndQualifierNameCodeSystem() { ConstrainedDatatype constraints = CreateConstraints(true); CodedTypeR2 <Code> codedType = CreateCodedType(); codedType.Qualifier[0].Name = new CodedTypeR2 <Code>(); this.constraintsHandler.HandleConstraints(constraints, codedType, this.errorLogger); Assert.IsTrue(this.errors.IsEmpty()); Assert.AreEqual("121139", codedType.Qualifier[0].Name.GetCodeValue()); Assert.AreEqual("1.2.840.10008.2.16.4", codedType.Qualifier[0].Name.GetCodeSystem()); }
private CodedTypeR2 <Code> CreateCodedType() { Code codeWithFixedCodeSystem = this.trivialCodeResolver.Lookup <ActStatus>(TYPE, "aCode", "1.2.840.10008.2.6.1"); Code name = this.trivialCodeResolver.Lookup <ActStatus>(TYPE, "121139", "1.2.840.10008.2.16.4"); Code value = this.trivialCodeResolver.Lookup <ActStatus>(TYPE, "anotherCode", "1.2.88888888"); CodeRole qualifier = new CodeRole(new CodedTypeR2 <Code>(name), new CodedTypeR2 <Code>(value)); CodedTypeR2 <Code> codedType = new CodedTypeR2 <Code>(codeWithFixedCodeSystem); codedType.Qualifier.Add(qualifier); return(codedType); }
public virtual void TestMissingQualifierValueCodeAndCodeSystemPasses() { ConstrainedDatatype constraints = CreateConstraints(true); CodedTypeR2 <Code> codedType = CreateCodedType(); codedType.Qualifier[0].Value = new CodedTypeR2 <Code>(); this.constraintsHandler.HandleConstraints(constraints, codedType, this.errorLogger); Assert.IsTrue(this.errors.IsEmpty()); Assert.IsNull(codedType.Qualifier[0].Value.GetCodeValue()); Assert.IsNull(codedType.Qualifier[0].Value.GetCodeSystem()); }
private void HandleSimpleValue(CodedTypeR2 <Code> codedType, StringBuilder result, FormatContext context) { // simpleValue (String) if (HasSimpleValue(codedType)) { if (SimpleValueAllowed()) { result.Append(XmlStringEscape.Escape(codedType.SimpleValue)); } } }
protected override CodedTypeR2 <Code> ParseTranslation(XmlElement translationElement, ParseContext newContext, XmlToModelResult result) { BareANY anyResult = new CdR2ElementParser().Parse(newContext, translationElement, result); CodedTypeR2 <Code> translation = anyResult == null ? null : (CodedTypeR2 <Code>)anyResult.BareValue; if (translation != null) { translation.NullFlavorForTranslationOnly = anyResult == null ? null : anyResult.NullFlavor; } return(translation); }
public virtual void TestMissingQualifierValue() { ConstrainedDatatype constraints = CreateConstraints(true); CodedTypeR2 <Code> codedType = CreateCodedType(); codedType.Qualifier[0].Value = null; this.constraintsHandler.HandleConstraints(constraints, codedType, this.errorLogger); Assert.IsFalse(this.errors.IsEmpty()); Assert.AreEqual(1, this.errors.Count); Assert.AreEqual(Hl7ErrorCode.CDA_MANDATORY_CONSTRAINT_MISSING, this.errors[0].GetHl7ErrorCode()); Assert.IsTrue(this.errors[0].GetMessage().Contains(" qualifier.value ")); }
private CodedTypeR2 <ConsultDocumentType> GetLoincCode() { ConsultDocumentType code = CodeResolverRegistry.Lookup <ConsultDocumentType>(typeof(ConsultDocumentType), "11488-4", "2.16.840.1.113883.6.1"); CodedTypeR2 <ConsultDocumentType> loincCode = new CodedTypeR2 <ConsultDocumentType>(); loincCode.Code = code; loincCode.CodeSystemName = "LOINC"; loincCode.DisplayName = "ConsultationNote"; return(loincCode); }
public virtual void TestEverythingSpecified() { CodedTypeR2 <Code> translation1 = new CodedTypeR2 <Code>(); translation1.Code = CeRxDomainTestValues.KILOGRAM; CodedTypeR2 <Code> translation2 = new CodedTypeR2 <Code>(); translation2.Code = CeRxDomainTestValues.FLUID_OUNCE; CodedTypeR2 <Code> name1 = new CodedTypeR2 <Code>(); name1.Code = CeRxDomainTestValues.CENTIMETRE; CodedTypeR2 <Code> name2 = new CodedTypeR2 <Code>(); name2.Code = Ca.Infoway.Messagebuilder.Domainvalue.Payload.AdministrativeGender.MALE; CodedTypeR2 <Code> value1 = new CodedTypeR2 <Code>(); value1.Code = Ca.Infoway.Messagebuilder.Domainvalue.Controlact.ActStatus.NORMAL; CodedTypeR2 <Code> value2 = new CodedTypeR2 <Code>(); value2.Code = Ca.Infoway.Messagebuilder.Domainvalue.Controlact.ActClass.ACT; CodeRole codeRole1 = new CodeRole(name1, value1, true); CodeRole codeRole2 = new CodeRole(name2, value2, true); CodedTypeR2 <Code> codedType = new CodedTypeR2 <Code>(); codedType.Code = CeRxDomainTestValues.CENTIMETRE; codedType.CodeSystemName = "aCodeSystemName"; codedType.CodeSystemVersion = "aCodeSystemVersion"; codedType.DisplayName = "aDisplayName"; codedType.SimpleValue = "simpleValue"; codedType.Operator = SetOperator.CONVEX_HULL; codedType.Value = BigDecimal.ONE; codedType.Operator = SetOperator.INTERSECT; codedType.Qualifier.Add(codeRole1); codedType.Qualifier.Add(codeRole2); codedType.Translation.Add(translation1); codedType.Translation.Add(translation2); codedType.Qty = 1122; EncapsulatedData originalText = new EncapsulatedData(); originalText.Content = "some original text"; codedType.OriginalText = originalText; BXIT <CodedTypeR2 <Code> > sxcm_cd = new BXITImpl <CodedTypeR2 <Code> >(codedType); string result = new BxitCdR2PropertyFormatter().Format(GetContext("name", "BXIT<CD>"), sxcm_cd); Assert.IsFalse(this.result.IsValid()); Assert.AreEqual(3, this.result.GetHl7Errors().Count); AssertXml("result", "<name code=\"cm\" codeSystem=\"1.2.3.4\" codeSystemName=\"aCodeSystemName\" codeSystemVersion=\"aCodeSystemVersion\" displayName=\"aDisplayName\" qty=\"1122\">" + "<originalText>some original text</originalText>" + "<qualifier inverted=\"true\"><name code=\"cm\" codeSystem=\"1.2.3.4\"/><value code=\"normal\" codeSystem=\"2.16.840.1.113883.5.14\" displayName=\"Normal\"/></qualifier>" + "<qualifier inverted=\"true\"><name code=\"M\" codeSystem=\"2.16.840.1.113883.5.1\" displayName=\"Male\"/><value code=\"ACT\" codeSystem=\"2.16.840.1.113883.5.6\" displayName=\"Act\"/></qualifier>" + "<translation code=\"kg\" codeSystem=\"1.2.3.4\"/>" + "<translation code=\"[foz_br]\" codeSystem=\"1.2.3.4\"/>" + "</name>" , StringUtils.Trim(result), true); }