Пример #1
0
        public void read_csv_with_copious_escaped_delimiters(WhiteSpacePreservation whiteSpacePreservation)
        {
            var repeatCount = 100000;

            using (var textReader = new EnumerableStringReader(Data.CopiousEscapedDelimitersLines.Repeat(repeatCount)))
            using (var csvReader = new CsvReader(textReader))
            {
                csvReader.PreserveLeadingWhiteSpace = whiteSpacePreservation.HasFlag(WhiteSpacePreservation.Leading);
                csvReader.PreserveTrailingWhiteSpace = whiteSpacePreservation.HasFlag(WhiteSpacePreservation.Trailing);

                while (csvReader.HasMoreRecords)
                {
                    csvReader.ReadDataRecord();
                }

                Assert.Equal(repeatCount, csvReader.RecordNumber);
            }
        }
Пример #2
0
        public void read_plain_csv(WhiteSpacePreservation whiteSpacePreservation)
        {
            var repeatCount = 100000;

            using (var textReader = new EnumerableStringReader(Data.PlainDataLines.Repeat(repeatCount)))
            using (var csvReader = new CsvReader(textReader))
            {
                csvReader.PreserveLeadingWhiteSpace = whiteSpacePreservation.HasFlag(WhiteSpacePreservation.Leading);
                csvReader.PreserveTrailingWhiteSpace = whiteSpacePreservation.HasFlag(WhiteSpacePreservation.Trailing);

                while (csvReader.HasMoreRecords)
                {
                    csvReader.ReadDataRecord();
                }

                Assert.Equal(3 * repeatCount, csvReader.RecordNumber);
            }
        }
Пример #3
0
        public void skip_stackoverflow_csv(WhiteSpacePreservation whiteSpacePreservation)
        {
            var repeatCount = 30000;

            using (var textReader = new EnumerableStringReader(Data.StackoverflowLines.Repeat(repeatCount)))
                using (var csvReader = new CsvReader(textReader))
                {
                    csvReader.PreserveLeadingWhiteSpace  = whiteSpacePreservation.HasFlag(WhiteSpacePreservation.Leading);
                    csvReader.PreserveTrailingWhiteSpace = whiteSpacePreservation.HasFlag(WhiteSpacePreservation.Trailing);

                    while (csvReader.HasMoreRecords)
                    {
                        csvReader.SkipRecord();
                    }

                    Assert.Equal(20 * repeatCount, csvReader.RecordNumber);
                }
        }
Пример #4
0
        public void skip_csv_with_unnecessary_delimiters(WhiteSpacePreservation whiteSpacePreservation)
        {
            var repeatCount = 100000;

            using (var textReader = new EnumerableStringReader(Data.UnnecessarilyDelimitedLines.Repeat(repeatCount)))
                using (var csvReader = new CsvReader(textReader))
                {
                    csvReader.PreserveLeadingWhiteSpace  = whiteSpacePreservation.HasFlag(WhiteSpacePreservation.Leading);
                    csvReader.PreserveTrailingWhiteSpace = whiteSpacePreservation.HasFlag(WhiteSpacePreservation.Trailing);

                    while (csvReader.HasMoreRecords)
                    {
                        csvReader.SkipRecord();
                    }

                    Assert.Equal(3 * repeatCount, csvReader.RecordNumber);
                }
        }
Пример #5
0
        public void read_plain_csv(WhiteSpacePreservation whiteSpacePreservation)
        {
            var repeatCount = 100000;

            using (var textReader = new EnumerableStringReader(Data.PlainDataLines.Repeat(repeatCount)))
                using (var csvReader = new CsvReader(textReader))
                {
                    csvReader.PreserveLeadingWhiteSpace  = whiteSpacePreservation.HasFlag(WhiteSpacePreservation.Leading);
                    csvReader.PreserveTrailingWhiteSpace = whiteSpacePreservation.HasFlag(WhiteSpacePreservation.Trailing);

                    while (csvReader.HasMoreRecords)
                    {
                        csvReader.ReadDataRecord();
                    }

                    Assert.Equal(3 * repeatCount, csvReader.RecordNumber);
                }
        }
Пример #6
0
        public void read_csv_with_copious_escaped_delimiters(WhiteSpacePreservation whiteSpacePreservation)
        {
            var repeatCount = 100000;

            using (var textReader = new EnumerableStringReader(Data.CopiousEscapedDelimitersLines.Repeat(repeatCount)))
                using (var csvReader = new CsvReader(textReader))
                {
                    csvReader.PreserveLeadingWhiteSpace  = whiteSpacePreservation.HasFlag(WhiteSpacePreservation.Leading);
                    csvReader.PreserveTrailingWhiteSpace = whiteSpacePreservation.HasFlag(WhiteSpacePreservation.Trailing);

                    while (csvReader.HasMoreRecords)
                    {
                        csvReader.ReadDataRecord();
                    }

                    Assert.Equal(repeatCount, csvReader.RecordNumber);
                }
        }
Пример #7
0
        public void skip_csv_with_copious_whitespace(WhiteSpacePreservation whiteSpacePreservation)
        {
            var repeatCount = 100000;

            using (var textReader = new EnumerableStringReader(Data.CopiousWhiteSpaceLines.Repeat(repeatCount)))
            using (var csvReader = new CsvReader(textReader))
            {
                csvReader.PreserveLeadingWhiteSpace = whiteSpacePreservation.HasFlag(WhiteSpacePreservation.Leading);
                csvReader.PreserveTrailingWhiteSpace = whiteSpacePreservation.HasFlag(WhiteSpacePreservation.Trailing);

                while (csvReader.HasMoreRecords)
                {
                    csvReader.SkipRecord();
                }

                Assert.Equal(3 * repeatCount, csvReader.RecordNumber);
            }
        }
Пример #8
0
        public override void Deserialize(IXunitSerializationInfo data)
        {
            base.Deserialize(data);

            this.whiteSpacePreservation = data.GetValue<WhiteSpacePreservation>("WhiteSpacePreservation");
        }
Пример #9
0
 public ReadPerformanceTestCase(IMessageSink diagnosticMessageSink, TestMethodDisplay testMethodDisplay, ITestMethod testMethod, WhiteSpacePreservation whiteSpacePreservation)
     : base(diagnosticMessageSink, testMethodDisplay, testMethod)
 {
     this.whiteSpacePreservation = whiteSpacePreservation;
     this.TestMethodArguments = new object[] { this.whiteSpacePreservation };
 }
Пример #10
0
        public override void Deserialize(IXunitSerializationInfo data)
        {
            base.Deserialize(data);

            this.whiteSpacePreservation = data.GetValue <WhiteSpacePreservation>("WhiteSpacePreservation");
        }
Пример #11
0
 public ReadPerformanceTestCase(IMessageSink diagnosticMessageSink, TestMethodDisplay testMethodDisplay, ITestMethod testMethod, WhiteSpacePreservation whiteSpacePreservation)
     : base(diagnosticMessageSink, testMethodDisplay, testMethod)
 {
     this.whiteSpacePreservation = whiteSpacePreservation;
     this.TestMethodArguments    = new object[] { this.whiteSpacePreservation };
 }
Пример #12
0
        public void skip_stackoverflow_csv(WhiteSpacePreservation whiteSpacePreservation)
        {
            var repeatCount = 30000;

            using (var textReader = new EnumerableStringReader(Data.StackoverflowLines.Repeat(repeatCount)))
            using (var csvReader = new CsvReader(textReader))
            {
                csvReader.PreserveLeadingWhiteSpace = whiteSpacePreservation.HasFlag(WhiteSpacePreservation.Leading);
                csvReader.PreserveTrailingWhiteSpace = whiteSpacePreservation.HasFlag(WhiteSpacePreservation.Trailing);

                while (csvReader.HasMoreRecords)
                {
                    csvReader.SkipRecord();
                }

                Assert.Equal(20 * repeatCount, csvReader.RecordNumber);
            }
        }
Пример #13
0
 public ReadPerformanceTestCommand(IMethodInfo method, WhiteSpacePreservation whiteSpacePreservation)
     : base(method, method.Name, -1)
 {
     this.whiteSpacePreservation = whiteSpacePreservation;
 }