public virtual void TestParseValueCompressedTextData() { XmlNode node = CreateNode("<name compression=\"GZ\" language=\"en-CA\" mediaType=\"text/plain\" representation=\"B64\">" + "H4sIAAAAAAAAALOpyM2xS8vPt9EHMQATOK6nDgAAAA==</name>"); CompressedData data = (CompressedData) new EdElementParser().Parse(CreateContext("ED.DOC", SpecificationVersion.V02R02), node , this.xmlResult).BareValue; Assert.IsTrue(this.xmlResult.IsValid()); Assert.AreEqual(Ca.Infoway.Messagebuilder.Domainvalue.Basic.X_DocumentMediaType.PLAIN_TEXT, data.MediaType, "media type"); Assert.AreEqual(Compression.GZIP, data.Compression, "Compression type"); Assert.AreEqual("en-CA", data.Language, "language"); Assert.AreEqual("<xml>foo</xml>", BytesUtil.AsString(data.UncompressedContent), "content"); }
public virtual void TestParseRepresentationValidB64() { string content = Base64.EncodeBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes("text value")); XmlNode node = CreateNode("<something representation=\"B64\" compression=\"DF\" mediaType=\"text/plain\">" + content + "</something>" ); EncapsulatedData value = (EncapsulatedData) new EdElementParser().Parse(CreateContext("ED.DOC", SpecificationVersion.R02_04_03 ), node, this.xmlResult).BareValue; Assert.IsTrue(this.xmlResult.IsValid()); Assert.AreEqual("text value", BytesUtil.AsString(Base64.DecodeBase64(System.Text.ASCIIEncoding.ASCII.GetBytes(value.Content ))), "proper text returned"); Assert.AreEqual(Ca.Infoway.Messagebuilder.Domainvalue.Basic.X_DocumentMediaType.PLAIN_TEXT, value.MediaType, "proper media type returned" ); Assert.IsNull(value.Reference, "no reference"); }