Example #1
0
        public virtual void TestNullCase()
        {
            ANYImpl <object> urgImpl = new ANYImpl <object>(null, null, StandardDataType.AD);
            string           result  = new AnyR2PropertyFormatter().Format(new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl
                                                                               (this.result, null, "name", "ANY", null, null, false), urgImpl, 0);

            AssertXml("result", "<name nullFlavor=\"NI\"/>", result);
        }
Example #2
0
        public virtual void TestPn()
        {
            PersonName       name   = PersonName.CreateFirstNameLastName("John", "Smith");
            ANYImpl <object> pnImpl = new ANYImpl <object>(name, null, StandardDataType.PN);
            string           result = new AnyR2PropertyFormatter().Format(new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl
                                                                              (this.result, null, "name", "ANY", null, null, false, SpecificationVersion.R02_04_02, null, null, null, false), pnImpl,
                                                                          0);

            AssertXml("result", "<name use=\"L\" xsi:type=\"PN\"><given>John</given><family>Smith</family></name>", result);
        }
Example #3
0
        public virtual void TestPq()
        {
            object           quantity = CreateQuantity("12", Ca.Infoway.Messagebuilder.Domainvalue.Basic.UnitsOfMeasureCaseSensitive.GRAM);
            ANYImpl <object> pqImpl   = new ANYImpl <object>(quantity, null, StandardDataType.PQ);
            string           result   = new AnyR2PropertyFormatter().Format(new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl
                                                                                (this.result, null, "name", "ANY", null, null, false, SpecificationVersion.R02_04_02, null, null, null, false), pqImpl,
                                                                            0);

            AssertXml("result", "<name unit=\"g\" value=\"12\" xsi:type=\"PQ\"/>", result);
        }
Example #4
0
        public virtual void TestTs()
        {
            PlatformDate     date            = DateUtil.GetDate(2003, 2, 27);
            DateWithPattern  dateWithPattern = new DateWithPattern(date, "yyyyMMdd");
            ANYImpl <object> tsImpl          = new ANYImpl <object>(new MbDate(dateWithPattern), null, StandardDataType.TS);
            string           result          = new AnyR2PropertyFormatter().Format(new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl
                                                                                       (this.result, null, "name", "ANY", null, null, false, SpecificationVersion.R02_04_02, null, null, null, false), tsImpl,
                                                                                   0);

            AssertXml("result", "<name value=\"20030327\" xsi:type=\"TS\"/>", result);
        }
Example #5
0
        public virtual void TestSt()
        {
            string           myString = "some value";
            ANYImpl <object> stImpl   = new ANYImpl <object>(myString, null, StandardDataType.ST);

            stImpl.Language = "en-CA";
            string result = new AnyR2PropertyFormatter().Format(new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl
                                                                    (this.result, null, "name", "ANY", null, null, false, SpecificationVersion.R02_04_02, null, null, null, false), stImpl,
                                                                0);

            AssertXml("result", "<name language=\"en-CA\" xsi:type=\"ST\">some value</name>", result);
        }
Example #6
0
        public virtual void TestFormatStWithCdataValue()
        {
            AnyR2PropertyFormatter formatter = new AnyR2PropertyFormatter();
            FormatContext          context   = GetContext("name", "ANY");
            ANYImpl <object>       dataType  = new ANYImpl <object>("something", null, StandardDataType.ST);

            dataType.IsCdata = true;
            string result = formatter.Format(context, dataType);

            Assert.AreEqual(AddLineSeparator("<name xsi:type=\"ST\"><![CDATA[something]]></name>"), result, "something in text node");
            Assert.IsTrue(this.result.IsValid());
        }
Example #7
0
        public virtual void TestPqWithNullFlavor()
        {
            ANYImpl <object> pqImpl = new ANYImpl <object>(null, Ca.Infoway.Messagebuilder.Domainvalue.Nullflavor.NullFlavor.UNKNOWN, StandardDataType
                                                           .PQ);

            pqImpl.OriginalText = "orig text";
            string result = new AnyR2PropertyFormatter().Format(new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl
                                                                    (this.result, null, "name", "ANY", null, null, false, SpecificationVersion.R02_04_02, null, null, null, false), pqImpl,
                                                                0);

            AssertXml("result", "<name nullFlavor=\"UNK\"/>", result);
            Assert.IsTrue(this.result.IsValid());
        }