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

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

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

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

            Assert.AreEqual("asdf", result);
        }
Beispiel #3
0
        public void UnescapingText_WithContentAndNoEscapeChar_ReturnsContent()
        {
            string text = "asdf";

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

            Assert.AreEqual(text, result);
        }
Beispiel #4
0
        public void UnescapingText_WithNoContent_ReturnsEmptyString()
        {
            string text = string.Empty;

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

            Assert.AreEqual(text, result);
        }
Beispiel #5
0
 public void UnescapingText_WhenTextIsNull_ThrowsArgumentNullException()
 {
     Assert.Throws <ArgumentNullException>(() => Escaped.Unescape(null, ' '));
 }
Beispiel #6
0
 public void UnescapingText_WhenEscapeTheseCharsIsNull_ThrowsArgumentNullException()
 {
     Assert.Throws <ArgumentNullException>(() => Escaped.Unescape(string.Empty, ' ', null));
 }