Skip to content

Commit

Permalink
teste with and without parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
leandromoh committed Nov 12, 2023
1 parent 69cd064 commit 047a016
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions RecordParser.Test/QuotedFileReaderTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using RecordParser.Builders.Reader;
using RecordParser.Extensions;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
Expand All @@ -19,11 +20,20 @@ public class Quoted
public Gender Gender;
}

public static IEnumerable<object[]> QuotedFieldsAnyColumn()
{
foreach (var parallel in new[] { true, false })
{
foreach (var newline in new[] { "\r", "\n", "\r\n" })
{
yield return new object[] { parallel, newline };
}
}
}

[Theory]
[InlineData("\r")]
[InlineData("\n")]
[InlineData("\r\n")]
public void Given_quoted_field_in_any_column_should_parse_successfully(string newline)
[MemberData(nameof(QuotedFieldsAnyColumn))]
public void Given_quoted_field_in_any_column_should_parse_successfully(bool parallel, string newline)
{
// Arrange

Expand Down Expand Up @@ -71,16 +81,17 @@ public void Given_quoted_field_in_any_column_should_parse_successfully(string ne
Separator = ",",
ParallelismOptions = new()
{
Enabled = false,
MaxDegreeOfParallelism = 2
Enabled = parallel,
MaxDegreeOfParallelism = 2,
EnsureOriginalOrdering = true,
},
};

// Act

var records = reader.ReadRecordsRaw(options, getField =>
{
var record =
var record =
(
getField(0),
getField(1),
Expand Down

0 comments on commit 047a016

Please sign in to comment.