Exemplo n.º 1
0
        public virtual void TestFormatValueWithMissingSpecializationType()
        {
            string expectedResult = "<name mediaType=\"text/plain\" specializationType=\"ED.DOC\" xsi:type=\"ED\">" + "this is some text &amp; some &quot;more&quot;</name>"
                                    + SystemUtils.LINE_SEPARATOR;
            EDImpl <EncapsulatedData> edImp = new EDImpl <EncapsulatedData>(new EncapsulatedData(Ca.Infoway.Messagebuilder.Domainvalue.Basic.X_DocumentMediaType
                                                                                                 .PLAIN_TEXT, null, null, System.Text.ASCIIEncoding.ASCII.GetBytes("this is some text & some \"more\"")));
            string result = new EdPropertyFormatter().Format(GetContext("name", "ED.DOCORREF"), edImp);

            Assert.IsFalse(this.result.IsValid());
            Assert.AreEqual(1, this.result.GetHl7Errors().Count);
            AssertXml("something in text node", expectedResult, result, true);
        }
Exemplo n.º 2
0
 private void HandleOriginalText(CodedTypeR2 <Code> codedType, int indentLevel, StringBuilder result, FormatContext context
                                 )
 {
     if (HasOriginalText(codedType))
     {
         if (OriginalTextAllowed())
         {
             EncapsulatedData          originalText = codedType.OriginalText;
             EDImpl <EncapsulatedData> edAny        = new EDImpl <EncapsulatedData>(originalText);
             FormatContext             newContext   = new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl("ED", "originalText"
                                                                                                                                , context);
             string formattedOriginalText = this.edFormatter.Format(newContext, edAny, indentLevel);
             if (StringUtils.IsNotBlank(formattedOriginalText))
             {
                 result.Append(formattedOriginalText);
             }
         }
     }
 }
Exemplo n.º 3
0
        private void WriteThumbnail(EncapsulatedData encapsulatedData, StringBuilder buffer, int indentLevel, FormatContext context
                                    )
        {
            EncapsulatedData thumbnail = encapsulatedData.Thumbnail;

            if (thumbnail != null)
            {
                if (thumbnail.Thumbnail != null)
                {
                    RecordError("For ED types, the thumbnail property itself cannot also have a thumbnail", context);
                }
                ED <EncapsulatedData> thumbnailWrapper = new EDImpl <EncapsulatedData>(thumbnail);
                FormatContext         newContext       = new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl("ED", "thumbnail", context
                                                                                                                                   );
                string formattedThumbnail = this.Format(newContext, thumbnailWrapper, indentLevel);
                if (StringUtils.IsNotBlank(formattedThumbnail))
                {
                    buffer.Append(formattedThumbnail);
                }
            }
        }