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

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

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

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

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

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

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

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

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