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> 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(translation1); codedType.Translation.Add(translation2); codedType.Qualifier.Add(new CodeRole()); EncapsulatedData originalText = new EncapsulatedData(); originalText.Content = "some original text"; codedType.OriginalText = originalText; CE_R2 <Code> ce = new CE_R2Impl <Code>(codedType); string result = new CeR2PropertyFormatter().Format(GetContext("name", "CE"), ce); Assert.IsFalse(this.result.IsValid()); Assert.AreEqual(4, 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>" + "<translation code=\"kg\" codeSystem=\"1.2.3.4\"/>" + "<translation code=\"[foz_br]\" codeSystem=\"1.2.3.4\"/>" + "</name>", StringUtils.Trim(result), true); }
public virtual void TestOriginalTextAndNullFlavor() { CodedTypeR2 <Code> codedType = new CodedTypeR2 <Code>(); EncapsulatedData originalText = new EncapsulatedData(); originalText.Content = "original text allowed for CE"; codedType.OriginalText = originalText; CE_R2 <Code> ce = new CE_R2Impl <Code>(codedType); ce.NullFlavor = Ca.Infoway.Messagebuilder.Domainvalue.Nullflavor.NullFlavor.NO_INFORMATION; string result = new HxitCeR2PropertyFormatter().Format(GetContext("name", "HXIT<CE>"), ce); Assert.IsTrue(this.result.IsValid()); AssertXml("result", "<name nullFlavor=\"NI\"><originalText>original text allowed for CE</originalText></name>", StringUtils .Trim(result), true); }
private string HandleEvent(EventRelatedPeriodicIntervalTime value, FormatContext context, int indentLevel) { string result = string.Empty; if (value.Event != null) { FormatContext newContext = new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl("CE", "event", context ); CodedTypeR2 <Code> codedType = new CodedTypeR2 <Code>(); //Fixup for .NET codedType.Code = value.Event; codedType.CodeSystemName = "TimingEvent"; CE_R2 <Code> ceAny = new CE_R2Impl <Code>(codedType); result = this.ceR2PropertyFormatter.Format(newContext, ceAny, indentLevel); } return(result); }
public virtual void TestEverythingSpecified() { 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.SimpleValue = "simpleValue"; codedType.Operator = SetOperator.CONVEX_HULL; codedType.Value = BigDecimal.ONE; codedType.Translation.Add(translation1); codedType.Translation.Add(translation2); codedType.Qualifier.Add(new CodeRole()); codedType.ValidTime = interval; EncapsulatedData originalText = new EncapsulatedData(); originalText.Content = "some original text"; codedType.OriginalText = originalText; CE_R2 <Code> ce = new CE_R2Impl <Code>(codedType); string result = new HxitCeR2PropertyFormatter().Format(GetContext("name", "HXIT<CE>"), ce); Assert.IsFalse(this.result.IsValid()); Assert.AreEqual(4, 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>" + "<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 ); }