public virtual void TestNoValueAndOptional() { CVImpl cv = new CVImpl(null); string result = new CvPropertyFormatterTest.TestableCvPropertyFormatter().Format(new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl (this.result, null, "name", null, Ca.Infoway.Messagebuilder.Xml.ConformanceLevel.OPTIONAL, null, false, SpecificationVersion .R02_04_02, null, null, CodingStrength.CNE, false), cv); Assert.IsTrue(this.result.IsValid()); Assert.AreEqual(string.Empty, StringUtils.Trim(result), "result"); }
public virtual void ShouldCopyOriginalTextFromCVImplObjectToBean() { BeanD beanD = new BeanD(); BeanWrapper wrapper = new BeanWrapper(beanD); CVImpl cvImpl = new CVImpl(CodeResolverRegistry.Lookup <IntoleranceValue>("CODE")); cvImpl.OriginalText = ORIGINAL_TEXT; wrapper.Write(new Relationship("value", "CV", Cardinality.Create("0-1")), cvImpl); Assert.AreEqual(ORIGINAL_TEXT, ((CV)beanD.GetField("someCode")).OriginalText, "originalText"); }
public virtual void TestNoValueAndMandatory() { CVImpl cv = new CVImpl(null); string result = new CvPropertyFormatterTest.TestableCvPropertyFormatter().Format(new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl (this.result, null, "name", null, Ca.Infoway.Messagebuilder.Xml.ConformanceLevel.MANDATORY, null, false, SpecificationVersion .R02_04_02, null, null, CodingStrength.CNE, false), cv); Assert.IsFalse(this.result.IsValid()); Assert.AreEqual(1, this.result.GetHl7Errors().Count); Assert.AreEqual("<name/>", StringUtils.Trim(result), "result"); }
public virtual void TestOriginalTextAndNullFlavor() { CVImpl cv = new CVImpl(Ca.Infoway.Messagebuilder.Domainvalue.Nullflavor.NullFlavor.NO_INFORMATION); cv.OriginalText = "some original text"; string result = new CvPropertyFormatterTest.TestableCvPropertyFormatter().Format(GetContext("name"), cv); Assert.IsTrue(this.result.IsValid()); Assert.AreEqual("<name nullFlavor=\"NI\"><originalText>some original text</originalText></name>", StringUtils.Trim(result ), "result"); }
public virtual void TestOriginalText() { CVImpl cv = new CVImpl(null); cv.OriginalText = "some original text"; string result = new CvPropertyFormatterTest.TestableCvPropertyFormatter().Format(new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl (this.result, null, "name", "CV", null, null, false, SpecificationVersion.R02_04_03, null, null, CodingStrength.CWE, false ), cv); Assert.IsTrue(this.result.IsValid()); Assert.AreEqual("<name><originalText>some original text</originalText></name>", StringUtils.Trim(result), "result"); }
public virtual void TestHandlingOfSimpleCodesWithDisplayNameForBCWithNullFlavor() { CVImpl cvImpl = new CVImpl(Ca.Infoway.Messagebuilder.Domainvalue.Nullflavor.NullFlavor.NOT_APPLICABLE); cvImpl.DisplayName = "testDisplayName"; FormatContext context = GetContext("name", StandardDataType.CV.Type, SpecificationVersion.V02R04_BC); string result = new CvPropertyFormatterTest.TestableCvPropertyFormatter().Format(context, cvImpl); Assert.AreEqual(1, this.result.GetHl7Errors().Count); Assert.AreEqual("CV should not include the 'displayName' property (when a nullFlavor)", this.result.GetHl7Errors()[0].GetMessage ()); Assert.AreEqual("<name displayName=\"testDisplayName\" nullFlavor=\"NA\"/>", StringUtils.Trim(result), "result"); }
public virtual void TestHandlingOfSimpleCodesWithDisplayNameForBC() { CVImpl cvImpl = new CVImpl(CeRxDomainTestValues.CENTIMETRE); cvImpl.DisplayName = "testDisplayName"; FormatContext context = GetContext("name", StandardDataType.CV.Type, SpecificationVersion.V02R04_BC); string result = new CvPropertyFormatterTest.TestableCvPropertyFormatter().Format(context, cvImpl); Assert.AreEqual(1, this.result.GetHl7Errors().Count); Assert.IsTrue(this.result.GetHl7Errors()[0].GetMessage().StartsWith("Could not locate a registered domain type to match " )); Assert.AreEqual("<name code=\"cm\" codeSystem=\"1.2.3.4\" displayName=\"testDisplayName\"/>", StringUtils.Trim(result), "result" ); }