Esempio n. 1
0
 public void TextualReader_PeekWhitespaceLine_TrueIfIsNotEndOfFile()
 {
     using (var sr = new StreamReader(new MemoryStream()))
     {
         var reader = new TextualReader(sr);
         Assert.False(reader.PeekWhitespaceLine());
     }
 }
Esempio n. 2
0
        public void TextualReader_PeekWhitespaceLine_TrueIfIsSpaceOrTabAndFalseOtherwise()
        {
            using (var ms = new MemoryStream())
            {
                var writer = new StreamWriter(ms);
                writer.WriteLine("ABC");
                writer.WriteLine(" DE");
                writer.WriteLine("\tF");
                writer.WriteLine("");
                writer.WriteLine("XYZ");
                writer.Flush();
                ms.Position = 0;

                var reader = new TextualReader(new StreamReader(ms));
                Assert.False(reader.PeekWhitespaceLine()); reader.ReadLine();
                Assert.True(reader.PeekWhitespaceLine()); reader.ReadLine();
                Assert.True(reader.PeekWhitespaceLine()); reader.ReadLine();
                Assert.False(reader.PeekWhitespaceLine()); reader.ReadLine();
                Assert.False(reader.PeekWhitespaceLine()); reader.ReadLine();
            }
        }