Ejemplo n.º 1
0
        public void TestBreakCharacter_NewLine()
        {
            using (Stream sIn = new FileStream(TESTFILE_DIR + "CarriageReturn.xml", FileMode.Open))
            {
                DocXReaderTestWriter writerOut = new DocXReaderTestWriter(null);

                br_Handler objectConsumer = new br_Handler(null);
                Helper_ParseFileIntoConsumer(sIn, writerOut, objectConsumer);

                Assert.IsFalse(objectConsumer.HasNonDocElements(), "br tag should not generate any nondoc elements");
                Helper_VerifySingleDocElementWasDispatchedOfType(writerOut, typeof(BreakCharacter));
                Assert.IsTrue(writerOut.Elements[0].IsContent);
                Assert.IsFalse(writerOut.Elements[0].IsStart);
                Assert.IsFalse(writerOut.Elements[0].IsEnd);

                Assert.AreEqual("\r", (writerOut.Elements[0] as BreakCharacter).Content);
            }
        }
Ejemplo n.º 2
0
        public void TestBreakCharacter_NewColumn()
        {
            using (Stream sIn = new FileStream(TESTFILE_DIR + "ColumnBreak.xml", FileMode.Open))
            {
                DocXReaderTestWriter writerOut = new DocXReaderTestWriter(null);

                br_Handler objectConsumer = new br_Handler(null);
                Helper_ParseFileIntoConsumer(sIn, writerOut, objectConsumer);

                Assert.IsFalse(objectConsumer.HasNonDocElements(), "br tag should not generate any nondoc elements");
                Helper_VerifySingleDocElementWasDispatchedOfType(writerOut, typeof(BreakCharacter));
                Assert.IsTrue(writerOut.Elements[0].IsContent);
                Assert.IsFalse(writerOut.Elements[0].IsStart);
                Assert.IsFalse(writerOut.Elements[0].IsEnd);

                StringBuilder sb = new StringBuilder();
                sb.Append((char)0xEA0D);
                string sExpected = sb.ToString();
                Assert.AreEqual(sExpected, (writerOut.Elements[0] as BreakCharacter).Content);
            }
        }