示例#1
0
        public void InputOfNewLineInAString_ReturnsANewLine()// input returns a new line char
        {
            string input    = "\r\n";
            string expected = "\r\n";
            var    actual   = TrimSpaces.CheckForWhiteSpace(input);

            Assert.AreEqual(expected, actual);
        }
示例#2
0
        public void CheckForTabsAndRemoveThemFromString()// check for tabs and remove
        {
            string input    = "abc\t ";
            string expected = "abc";
            var    actual   = TrimSpaces.CheckForWhiteSpace(input);

            Assert.AreEqual(expected, actual);
        }
示例#3
0
        public void RemoveWhiteSpaceAtTheEndOfSecondLine()// remove white space at the end of string
        {
            string input    = "abc\r\n cd \r\n";
            string expected = "abc\r\ncd\r\n";
            var    actual   = TrimSpaces.CheckForWhiteSpace(input);

            Assert.AreEqual(expected, actual);
        }
示例#4
0
        public void RemoveWhiteSpacesAtEndOfString()
        {
            string input    = "abc    ";
            string expected = "abc";
            var    actual   = TrimSpaces.CheckForWhiteSpace(input);

            Assert.AreEqual(expected, actual);
        }
示例#5
0
        public void KeepsWhitespaceAtBeginningOfString()// this test should retain white space at the beginning of a string
        {
            string input    = "      abc    ";
            string expected = "      abc";
            var    actual   = TrimSpaces.CheckForWhiteSpace(input);

            Assert.AreEqual(expected, actual);
        }
示例#6
0
        public void CheckForNoWhitespace_InAString()
        {
            string input    = "abc";
            string expected = "abc";
            var    actual   = TrimSpaces.CheckForWhiteSpace(input);

            Assert.AreEqual(expected, actual);
        }
示例#7
0
        public void RemoveWhiteSpaceInMiddleOfString()
        {
            string input    = "abc\r\n cd \r\n ";
            string expected = "abc\r\ncd\r\n";
            var    actual   = TrimSpaces.CheckForWhiteSpace(input);

            Assert.AreEqual(expected, actual);
        }
示例#8
0
        public void KeepsWhitespaceAtBeginningOfString()
        {
            string input    = "   abc    ";
            string expected = "   abc";
            var    actual   = TrimSpaces.CheckForWhiteSpace(input);

            Assert.AreEqual(expected, actual);
        }
示例#9
0
        public void CheckIfAStringIsEmpty_ReturnException()
        {
            string input = "";

            Assert.Throws <System.ArgumentException>(() => TrimSpaces.CheckForWhiteSpace(input));
        }
示例#10
0
        public void CheckIfAStringIsNull_ReturnException()
        {
            string input = null;

            Assert.Throws <System.NullReferenceException>(() => TrimSpaces.CheckForWhiteSpace(input));
        }