示例#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);
        }
示例#2
0
        public void EscapingText_WithCharToEscape_ReturnsEscaped()
        {
            string text = "asdf";

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

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

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

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

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

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

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

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