예제 #1
0
        public virtual void TestGetAttributeNameValuePairsNullValue()
        {
            IDictionary <string, string> result = new CdPropertyFormatterTest.TestableCdPropertyFormatter().GetAttributeNameValuePairsForTest
                                                      (new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl(this.result, null, "name", null, null, null,
                                                                                                                                 false), null, null);

            Assert.AreEqual(0, result.Count, "map size");
        }
예제 #2
0
        public virtual void TestHandlingOfTrivialCodes()
        {
            string result = new CdPropertyFormatterTest.TestableCdPropertyFormatter().Format(GetContext("name"), new CDImpl(Ca.Infoway.Messagebuilder.Domainvalue.Nullflavor.NullFlavor
                                                                                                                            .NO_INFORMATION));

            Assert.IsTrue(this.result.IsValid());
            Assert.AreEqual("<name nullFlavor=\"NI\"/>", StringUtils.Trim(result), "result");
        }
예제 #3
0
        public virtual void TestHandlingOfSimpleCodes()
        {
            string result = new CdPropertyFormatterTest.TestableCdPropertyFormatter().Format(GetContext("name"), new CDImpl(CeRxDomainTestValues
                                                                                                                            .CENTIMETRE));

            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\"/>", StringUtils.Trim(result), "result");
        }
예제 #4
0
        public virtual void TestNoValueAndOptional()
        {
            CDImpl cd     = new CDImpl(null);
            string result = new CdPropertyFormatterTest.TestableCdPropertyFormatter().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_03, null, null, CodingStrength.CNE, false), cd);

            Assert.IsTrue(this.result.IsValid());
            Assert.AreEqual(string.Empty, StringUtils.Trim(result), "result");
        }
예제 #5
0
        public virtual void TestOriginalTextAndNullFlavor()
        {
            CDImpl cd = new CDImpl(Ca.Infoway.Messagebuilder.Domainvalue.Nullflavor.NullFlavor.NO_INFORMATION);

            cd.OriginalText = "some original text";
            string result = new CdPropertyFormatterTest.TestableCdPropertyFormatter().Format(GetContext("name"), cd);

            Assert.IsTrue(this.result.IsValid());
            Assert.AreEqual("<name nullFlavor=\"NI\"><originalText>some original text</originalText></name>", StringUtils.Trim(result
                                                                                                                               ), "result");
        }
예제 #6
0
        public virtual void TestSingleTranslation()
        {
            CDImpl cd = new CDImpl(null);

            cd.Translations.Add(new CDImpl(MockEnum.FRED));
            string result = new CdPropertyFormatterTest.TestableCdPropertyFormatter().Format(GetContext("name"), cd);

            Assert.IsFalse(this.result.IsValid());
            Assert.AreEqual(1, this.result.GetHl7Errors().Count);
            // code/codeSystem mandatory
            Assert.AreEqual("<name><translation code=\"FRED\" codeSystem=\"1.2.3.4.5\"/></name>", StringUtils.Trim(result), "result");
        }
예제 #7
0
        public virtual void TestOriginalText()
        {
            CDImpl cd = new CDImpl(null);

            cd.OriginalText = "some original text";
            string result = new CdPropertyFormatterTest.TestableCdPropertyFormatter().Format(GetContext("name"), cd);

            Assert.IsFalse(this.result.IsValid());
            Assert.AreEqual(1, this.result.GetHl7Errors().Count);
            // code/codeSystem mandatory (need a CWE coding strength to allow this run to pass without errors)
            Assert.AreEqual("<name><originalText>some original text</originalText></name>", StringUtils.Trim(result), "result");
        }
예제 #8
0
        public virtual void TestGetAttributeNameValuePairs()
        {
            // used as expected: an enumerated object is passed in
            IDictionary <string, string> result = new CdPropertyFormatterTest.TestableCdPropertyFormatter().GetAttributeNameValuePairsForTest
                                                      (new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl(this.result, null, "name", null, null, null,
                                                                                                                                 false), CeRxDomainTestValues.CENTIMETRE, new CDImpl());

            Assert.AreEqual(2, result.Count, "map size");
            Assert.IsTrue(result.ContainsKey("code"), "key as expected");
            Assert.AreEqual("cm", result.SafeGet("code"), "value as expected");
            Assert.IsTrue(result.ContainsKey("codeSystem"), "key as expected");
            Assert.AreEqual("1.2.3.4", result.SafeGet("codeSystem"), "value as expected");
        }
예제 #9
0
        public virtual void TestNoInternalValuesAndMandatory()
        {
            CDImpl cd     = new CDImpl(new _Code_133());
            string result = new CdPropertyFormatterTest.TestableCdPropertyFormatter().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_03, null, null, CodingStrength.CNE, false), cd);

            Assert.IsFalse(this.result.IsValid());
            Assert.AreEqual(1, this.result.GetHl7Errors().Count);
            Assert.IsTrue(this.result.GetHl7Errors()[0].GetMessage().StartsWith("For codes with codingStrength of CNE, code and codeSystem properties must be provided."
                                                                                ));
            Assert.AreEqual("<name/>", StringUtils.Trim(result), "result");
        }
예제 #10
0
        public virtual void TestNoValueAndMandatory()
        {
            CDImpl cd     = new CDImpl(null);
            string result = new CdPropertyFormatterTest.TestableCdPropertyFormatter().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_03, null, null, CodingStrength.CNE, false), cd);

            Assert.IsFalse(this.result.IsValid());
            Assert.AreEqual(1, this.result.GetHl7Errors().Count);
            // "name" mandatory
            Assert.IsTrue(this.result.GetHl7Errors()[0].GetMessage().StartsWith("name is a mandatory field, but no value is specified"
                                                                                ), "error");
            Assert.AreEqual("<name/>", StringUtils.Trim(result), "result");
        }