1 /*----------------------------------------------------------------------------
 2 Name:      XmlBufferTest.cs
 3 Project:   xmlBlaster.org
 4 Copyright: xmlBlaster.org, see xmlBlaster-LICENSE file
 5 Author:    "Marcel Ruff" <xmlBlaster@marcelruff.info>
 6 Date:      2008
 7 See:       http://www.xmlblaster.org
 8 -----------------------------------------------------------------------------*/
 9 using System;
10 using System.Text;
11 using NUnit.Framework;
12 using System.Collections;
13 using org.xmlBlaster.util;
14 
15 namespace org.xmlBlaster.util {
16    [TestFixture]
17    public class XmlBufferTest {
18       [Test]
19       public void CheckEscape() {
20          XmlBuffer b = new XmlBuffer(1020);
21          b.Append("<pc><pr key='").AppendAttributeEscaped("Oh&<").Append("'>").AppendEscaped("Oi<>!").Append("</pr></pc>");
22          string xml = b.ToString();
23          Assert.AreEqual("<pc><pr key='Oh&amp;&lt;'>Oi&lt;&gt;!</pr></pc>", xml);
24       }
25       [Test]
26       public void CheckUnEscape() {
27          string xml = "&lt;pc>&lt;pr k=&apos;aKey' d='0'/></pc&gt;";
28          string res = XmlBuffer.UnEscape(xml);
29          Assert.AreEqual("<pc><pr k='aKey' d='0'/></pc>", res);
30       }
31    }
32 }


syntax highlighted by Code2HTML, v. 0.9.1