Пример #1
0
        public void CanStringifyRunAndTextElements()
        {
            const string textValue           = "Hello World!";
            var          textElement         = new XElement(W.t, textValue);
            var          runElement          = new XElement(W.r, textElement);
            var          formattedRunElement = new XElement(W.r, new XElement(W.rPr, new XElement(W.b)), textElement);

            Assert.Equal(textValue, UnicodeMapper.RunToString(textElement));
            Assert.Equal(textValue, UnicodeMapper.RunToString(runElement));
            Assert.Equal(textValue, UnicodeMapper.RunToString(formattedRunElement));
        }
Пример #2
0
 public void CanStringifySpecialElements()
 {
     Assert.Equal(UnicodeMapper.CarriageReturn,
                  UnicodeMapper.RunToString(new XElement(W.cr)).First());
     Assert.Equal(UnicodeMapper.CarriageReturn,
                  UnicodeMapper.RunToString(new XElement(W.br)).First());
     Assert.Equal(UnicodeMapper.FormFeed,
                  UnicodeMapper.RunToString(new XElement(W.br, new XAttribute(W.type, "page"))).First());
     Assert.Equal(UnicodeMapper.NonBreakingHyphen,
                  UnicodeMapper.RunToString(new XElement(W.noBreakHyphen)).First());
     Assert.Equal(UnicodeMapper.SoftHyphen,
                  UnicodeMapper.RunToString(new XElement(W.softHyphen)).First());
     Assert.Equal(UnicodeMapper.HorizontalTabulation,
                  UnicodeMapper.RunToString(new XElement(W.tab)).First());
 }