예제 #1
0
파일: UnitTest2.cs 프로젝트: lunakv/Skola
        public void ReadWord_OnlyWhitespaceFollowedByNewline()
        {
            var inp = new MockInput("   \t  \t    \t\t\t  \n");
            var r   = new LineReader(inp);

            List <string> words = new List <string>();

            for (int i = 0; i < 2; i++)
            {
                words.Add(r.ReadWord());
            }

            CollectionAssert.AreEqual(new [] { "\n", null }, words);
        }
예제 #2
0
파일: UnitTest2.cs 프로젝트: lunakv/Skola
        public void ReadWord_OnlyNonWhitespace()
        {
            string line = "ThisisoneLonWordThatTheReaderShouldReadAsAWord";
            var    inp  = new MockInput(line);
            var    r    = new LineReader(inp);

            List <string> words = new List <string>();

            for (int i = 0; i < 2; i++)
            {
                words.Add(r.ReadWord());
            }

            CollectionAssert.AreEqual(new [] { line, null }, words);
        }
예제 #3
0
파일: UnitTest2.cs 프로젝트: lunakv/Skola
        public void ReadWord_WhiteSpaceFollowedByWord()
        {
            string word = "SomeWordToRead";
            string line = "   \t\t   \t " + word;
            var    inp  = new MockInput(line);
            var    r    = new LineReader(inp);

            List <string> words = new List <string>();

            for (int i = 0; i < 2; i++)
            {
                words.Add(r.ReadWord());
            }

            CollectionAssert.AreEqual(new [] { word, null }, words);
        }
예제 #4
0
파일: UnitTest2.cs 프로젝트: lunakv/Skola
        public void ReadWord_WordWhitespaceNewlineWhitespaceWord()
        {
            string word  = "SomeWordToRead";
            string word2 = "SomeOtherWord";
            string line  = word + "\t  \t\t\n \t  " + word2;
            var    inp   = new MockInput(line);
            var    r     = new LineReader(inp);

            List <string> words = new List <string>();

            for (int i = 0; i < 4; i++)
            {
                words.Add(r.ReadWord());
            }

            CollectionAssert.AreEqual(new [] { word, "\n", word2, null }, words);
        }