コード例 #1
0
        public void UnknownEscape()
        {
            Action act = () => StringOperators.FpEscape("Ewout", "reverse_polish");

            act.Should().Throw <ArgumentException>().Which.Message.StartsWith("Unknown escaping method 'reverse_polish'.");

            act = () => StringOperators.FpUnescape("Ewout", "reverse_polish");
            act.Should().Throw <ArgumentException>().Which.Message.StartsWith("Unknown escaping method 'reverse_polish'.");
        }
コード例 #2
0
        public void EscapeJson()
        {
            StringOperators.EscapeJson("hi\t\"there\"! \\/").Should().Be("hi\\t\\\"there\\\"! \\\\/");

            StringOperators.FpEscape("hi\nthere", "json").Should().Be("hi\\nthere");
        }
コード例 #3
0
        public void EscapeHtml()
        {
            StringOperators.EscapeHtml("\"Me < Me & Jou, Jou > Me.\", said he.").Should().Be("&quot;Me &lt; Me &amp; Jou, Jou &gt; Me.&quot;, said he.");

            StringOperators.FpEscape("1 < 5", "html").Should().Be("1 &lt; 5");
        }