Exemple #1
0
        public void MoveToTest_SeekableReader()
        {
            using (var ms = new MemoryStream())
            {
                var writer = new StreamWriter(ms, Encoding.Unicode);
                writer.Write(FixedWidthRecordReaderTestData.SampleData1);
                writer.Flush();

                ms.Position = 0;

                using (var fix = new FixedWidthRecordReader(new StreamReader(ms, Encoding.Unicode)))
                {
                    fix.StartCachingRecordPositions();
                    FixedWidthRecordReaderTestData.SetupReaderForSampleData1(fix);

                    while (fix.Read() == ReadResult.Success)
                    {
                    }

                    for (int i = FixedWidthRecordReaderTestData.SampleData1RecordCount - 1; i >= 0; i--)
                    {
                        Assert.AreEqual(ReadResult.Success, fix.MoveTo(i));
                        FixedWidthRecordReaderTestData.CheckSampleData1(fix, i);
                    }
                }
            }
        }
Exemple #2
0
 public void MoveToTest3()
 {
     using (var fix = new FixedWidthRecordReader(new StringReader(FixedWidthRecordReaderTestData.SampleData1)))
     {
         FixedWidthRecordReaderTestData.SetupReaderForSampleData1(fix);
         Assert.AreEqual(ReadResult.EndOfFile, fix.MoveTo(FixedWidthRecordReaderTestData.SampleData1RecordCount));
     }
 }
Exemple #3
0
        public void MoveToTest1()
        {
            using (var fix = new FixedWidthRecordReader(new StringReader(FixedWidthRecordReaderTestData.SampleData1)))
            {
                FixedWidthRecordReaderTestData.SetupReaderForSampleData1(fix);

                for (int i = 0; i < FixedWidthRecordReaderTestData.SampleData1RecordCount; i++)
                {
                    fix.MoveTo(i);
                    FixedWidthRecordReaderTestData.CheckSampleData1(fix, i);
                }
            }
        }