Example #1
0
        public void TestNestedAndMixed()
        {
            var function = new EscapeXmlFunction();

            Assert.That(function.Evaluate(
                            "I said use <code>\" not '</code> at <i>AT&T</i>. You are <b>fired</b>"),
                        Is.EqualTo(
                            "I said use &lt;code&gt;&quot; not &apos;&lt;/code&gt; at &lt;i&gt;AT&amp;T&lt;/i&gt;. You are &lt;b&gt;fired&lt;/b&gt;"));
        }
Example #2
0
        public void TestNothingToEscape()
        {
            var function = new EscapeXmlFunction();

            Assert.That(function.Evaluate("some text"), Is.EqualTo("some text"));
        }
Example #3
0
        public void TestEscapTags()
        {
            var function = new EscapeXmlFunction();

            Assert.That(function.Evaluate("You are <b>fired</b>"), Is.EqualTo("You are &lt;b&gt;fired&lt;/b&gt;"));
        }
Example #4
0
        public void TestEscapeQuotes()
        {
            var function = new EscapeXmlFunction();

            Assert.That(function.Evaluate("some \"text\""), Is.EqualTo("some &quot;text&quot;"));
        }
Example #5
0
        public void TestEscapeNull()
        {
            var function = new EscapeXmlFunction();

            Assert.That(function.Evaluate(new string[1]), Is.EqualTo(""));
        }
Example #6
0
        public void TestEscapeApostrorhe()
        {
            var function = new EscapeXmlFunction();

            Assert.That(function.Evaluate("some 'text'"), Is.EqualTo("some &apos;text&apos;"));
        }
Example #7
0
        public void TestEscapeAmpersand()
        {
            var function = new EscapeXmlFunction();

            Assert.That(function.Evaluate("Johnson & Johnon"), Is.EqualTo("Johnson &amp; Johnon"));
        }