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 TestOriginalTextAndNullFlavor() { CodedTypeR2 <Code> codedType = new CodedTypeR2 <Code>(); EncapsulatedData originalText = new EncapsulatedData(); originalText.Content = "original text allowed for CV"; codedType.OriginalText = originalText; CV_R2 <Code> cv = new CV_R2Impl <Code>(codedType); cv.NullFlavor = Ca.Infoway.Messagebuilder.Domainvalue.Nullflavor.NullFlavor.NO_INFORMATION; string result = new CvR2PropertyFormatter().Format(GetContext("name", "CV"), cv); Assert.IsTrue(this.result.IsValid()); AssertXml("result", "<name nullFlavor=\"NI\"><originalText>original text allowed for CV</originalText></name>", StringUtils .Trim(result), true); }