示例#1
0
        public void TestReadWrite()
        {
            FileInformationBlock fib = _hWPFDocFixture._fib;

            byte[] mainStream  = _hWPFDocFixture._mainStream;
            byte[] tableStream = _hWPFDocFixture._tableStream;
            int    fcMin       = fib.GetFcMin();

            _cHPBinTable = new CHPBinTable(mainStream, tableStream, fib.GetFcPlcfbteChpx(), fib.GetLcbPlcfbteChpx(), fcMin, fakeTPT);

            HWPFFileSystem fileSys = new HWPFFileSystem();

            _cHPBinTable.WriteTo(fileSys, 0);
            MemoryStream tableOut = fileSys.GetStream("1Table");
            MemoryStream mainOut  = fileSys.GetStream("WordDocument");

            byte[] newTableStream = tableOut.ToArray();
            byte[] newMainStream  = mainOut.ToArray();

            CHPBinTable newBinTable = new CHPBinTable(newMainStream, newTableStream, 0, newTableStream.Length, 0, fakeTPT);

            List <CHPX> oldTextRuns = _cHPBinTable._textRuns;
            List <CHPX> newTextRuns = newBinTable._textRuns;

            Assert.AreEqual(oldTextRuns.Count, newTextRuns.Count);

            int size = oldTextRuns.Count;

            for (int x = 0; x < size; x++)
            {
                PropertyNode oldNode = (PropertyNode)oldTextRuns[x];
                PropertyNode newNode = (PropertyNode)newTextRuns[x];
                Assert.IsTrue(oldNode.Equals(newNode));
            }
        }
示例#2
0
 public void tearDown()
 {
     _cHPBinTable    = null;
     _hWPFDocFixture = null;
 }