Exemplo n.º 1
0
        public void GetStreamData_Test()
        {
            MemoryStream      ms     = new MemoryStream();
            PDFIndirectObject indobj = new PDFIndirectObject(this);
            PDFStream         target = new StreamProxy(ms, _usefilters, indobj, false);

            byte[] expected = new byte[] {};
            byte[] actual;
            actual = target.GetStreamData();
            Assert.AreEqual(expected.Length, actual.Length);

            expected = new byte[] { 1, 2, 3, 4, 5 };
            target.Write(expected);
            target.Flush();

            actual = target.GetStreamData();

            Assert.AreEqual(expected.Length, actual.Length);

            for (int i = 0; i < expected.Length; i++)
            {
                Assert.AreEqual(expected[i], actual[i]);
            }

            target.Dispose();
            ms.Dispose();
            indobj.Dispose();
        }
Exemplo n.º 2
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();
        }
Exemplo n.º 3
0
        public void Write_Test1()
        {
            PDFIndirectObject indobj = new PDFIndirectObject(this);
            PDFStream         target = new StreamProxy(_usefilters, indobj);

            byte[] expected = new byte[] { 1, 2, 3, 4, 5 };
            target.Write(expected);
            target.Flush();
            byte[] actual = target.GetStreamData();

            CompareByteArray(expected, actual);

            target.Dispose();
            indobj.Dispose();
        }
Exemplo n.º 4
0
        public void WriteLine_Test()
        {
            PDFIndirectObject indobj = new PDFIndirectObject(this);
            PDFStream         target = new StreamProxy(_usefilters, indobj);

            string source = "Hello world";

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

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

            CompareByteArray(expected, actual);

            target.Dispose();
            indobj.Dispose();
        }
Exemplo n.º 5
0
        public void Write_Test()
        {
            PDFIndirectObject indobj = new PDFIndirectObject(this);
            PDFStream         target = new StreamProxy(_usefilters, indobj);

            byte[] expected = new byte[] { 0, 10, 1, 2, 3, 4, 5, 34, 35 };
            target.Write(expected, 2, 5);
            target.Flush();
            byte[] actual = target.GetStreamData();

            byte[] copied = new byte[5];
            Array.Copy(expected, 2, copied, 0, 5);

            CompareByteArray(copied, actual);

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