Ejemplo n.º 1
0
        public virtual void TestGetAttributeNameValuePairsNullValue()
        {
            IDictionary <string, string> result = new CsPropertyFormatterTest.TestableCsPropertyFormatter().GetAttributeNameValuePairsForTest
                                                      (new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl(new ModelToXmlResult(), null, "name", null, null
                                                                                                                                 , null, false), null, null);

            Assert.AreEqual(0, result.Count, "map size");
        }
Ejemplo n.º 2
0
        public virtual void TestGetAttributeNameValuePairsWithoutCodeSystem()
        {
            IDictionary <string, string> result = new CsPropertyFormatterTest.TestableCsPropertyFormatter().GetAttributeNameValuePairsForTest
                                                      (new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl(new ModelToXmlResult(), null, "name", null, null
                                                                                                                                 , null, false), new MockCodeImpl("fred", "The Flintstones"), null);

            Assert.AreEqual(1, result.Count, "map size");
            Assert.IsFalse(result.ContainsKey("codeSystem"), "key as expected");
        }
Ejemplo n.º 3
0
        public virtual void TestGetAttributeNameValuePairsEnum()
        {
            // used as expected: an enumerated object is passed in
            IDictionary <string, string> result = new CsPropertyFormatterTest.TestableCsPropertyFormatter().GetAttributeNameValuePairsForTest
                                                      (new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl(new ModelToXmlResult(), null, "name", null, null
                                                                                                                                 , null, false), CeRxDomainTestValues.CENTIMETRE, null);

            Assert.AreEqual(1, result.Count, "map size");
            Assert.IsTrue(result.ContainsKey("code"), "key as expected");
            Assert.AreEqual("cm", result.SafeGet("code"), "value as expected");
        }
Ejemplo n.º 4
0
        public virtual void TestFormatNullWithCodeSystem()
        {
            string xml = new CsPropertyFormatterTest.TestableCsPropertyFormatter().Format(GetContext("option"), new CSImpl(Ca.Infoway.Messagebuilder.Domainvalue.Nullflavor.NullFlavor
                                                                                                                           .OTHER));

            Assert.IsTrue(this.result.IsValid());
            XmlDocument document = new DocumentFactory().CreateFromString(xml);
            XmlNodeList list     = document.GetElementsByTagName("option");

            Assert.AreEqual(1, list.Count, "option");
            XmlElement result = ((XmlElement)list.Item(0));

            Assert.AreEqual("OTH", result.GetAttribute("nullFlavor"), "nullFlavor");
            Assert.IsFalse(result.HasAttribute("codeSystem"), "should not have codeSystem");
        }
Ejemplo n.º 5
0
        public virtual void TestGetAttributeNameValuePairsWithOriginalText()
        {
            CSImpl cs = new CSImpl(new CsPropertyFormatterTest.FakeCode(this));

            cs.OriginalText = "The Flintstones";
            string result = new CsPropertyFormatterTest.TestableCsPropertyFormatter().Format(GetContext("character"), cs);

            Assert.AreEqual(1, this.result.GetHl7Errors().Count);
            Assert.IsTrue(this.result.GetHl7Errors()[0].GetMessage().StartsWith("Could not locate a registered domain type to match "
                                                                                ));
            XmlDocument document = new DocumentFactory().CreateFromString(result);
            XmlNodeList list     = document.GetElementsByTagName("originalText");

            Assert.AreEqual(1, list.Count, "originalText");
        }