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); } }
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); } }
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); } }
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); } }
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); } }
public override void Deserialize(IXunitSerializationInfo data) { base.Deserialize(data); this.whiteSpacePreservation = data.GetValue<WhiteSpacePreservation>("WhiteSpacePreservation"); }
public ReadPerformanceTestCase(IMessageSink diagnosticMessageSink, TestMethodDisplay testMethodDisplay, ITestMethod testMethod, WhiteSpacePreservation whiteSpacePreservation) : base(diagnosticMessageSink, testMethodDisplay, testMethod) { this.whiteSpacePreservation = whiteSpacePreservation; this.TestMethodArguments = new object[] { this.whiteSpacePreservation }; }
public override void Deserialize(IXunitSerializationInfo data) { base.Deserialize(data); this.whiteSpacePreservation = data.GetValue <WhiteSpacePreservation>("WhiteSpacePreservation"); }
public ReadPerformanceTestCommand(IMethodInfo method, WhiteSpacePreservation whiteSpacePreservation) : base(method, method.Name, -1) { this.whiteSpacePreservation = whiteSpacePreservation; }