示例#1
0
        public void WriteTo_Test1()
        {
            PDFIndirectObject indobj = new PDFIndirectObject(this);
            PDFStream         target = new StreamProxy(_usefilters, indobj);

            PDFIndirectObject otherobj = new PDFIndirectObject(this);

            PDFStream other = new StreamProxy(_usefilters, otherobj);

            string source = "Hello world";

            target.WriteLine(source);
            target.Flush();


            byte[] expected = target.GetStreamData();
            target.WriteTo(other);
            byte[] actual = other.GetStreamData();

            CompareByteArray(expected, actual);

            target.Dispose();
            other.Dispose();
            indobj.Dispose();
            otherobj.Dispose();
        }
示例#2
0
        public void WriteTo_Test()
        {
            MemoryStream stream = new MemoryStream();

            PDFIndirectObject indobj = new PDFIndirectObject(this);
            PDFStream         target = new StreamProxy(_usefilters, indobj);

            string source = "Hello world";

            target.WriteLine(source);
            target.Flush();

            byte[] actual;
            byte[] expected = System.Text.Encoding.ASCII.GetBytes(source + "\r\n");

            target.WriteTo(stream);
            actual = stream.ToArray();

            CompareByteArray(expected, actual);

            target.Dispose();
            stream.Dispose();
            indobj.Dispose();
        }