Example #1
0
        public void EscapingText_WithEscapeCharAndCharsToEscape_ReturnsEscaped()
        {
            string text = "as\0df";

            string result = Escaped.Escape(text, '\0', 'a', 'd');

            Assert.AreEqual("\0as\0\0\0df", result);
        }
Example #2
0
        public void EscapingText_WithCharToEscape_ReturnsEscaped()
        {
            string text = "asdf";

            string result = Escaped.Escape(text, '\0', 'a');

            Assert.AreEqual("\0asdf", result);
        }
Example #3
0
        public void EscapingText_WithEscapeChar_ReturnsEscaped()
        {
            string text = "as\0df";

            string result = Escaped.Escape(text, '\0');

            Assert.AreEqual("as\0\0df", result);
        }
Example #4
0
        public void EscapingText_WithContentAndNoEscapeChar_ReturnsContent()
        {
            string text = "asdf";

            string result = Escaped.Escape(text, '\0', '\0');

            Assert.AreEqual(text, result);
        }
Example #5
0
        public void EscapingText_WithNoContent_ReturnsEmptyString()
        {
            string text = string.Empty;

            string result = Escaped.Escape(text, '\0', '\0');

            Assert.AreEqual(text, result);
        }
Example #6
0
 public void EscapingText_WhenTextIsNull_ThrowsArgumentNullException()
 {
     Assert.Throws <ArgumentNullException>(() => Escaped.Escape(null, ' '));
 }
Example #7
0
 public void EscapingText_WhenEscapeTheseCharsIsNull_ThrowsArgumentNullException()
 {
     Assert.Throws <ArgumentNullException>(() => Escaped.Escape(string.Empty, ' ', null));
 }