summaryrefslogtreecommitdiff
path: root/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings
diff options
context:
space:
mode:
Diffstat (limited to 'ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings')
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/AllowCommentsTests.cs29
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/BooleanValuesTests.cs37
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/BufferSizeTests.cs25
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/CacheFieldsTests.cs20
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/CommentTests.cs28
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/ConstantTests.cs50
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/CountBytesTest.cs20
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/DateTimeStylesTests.cs37
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/DefaultTests.cs37
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/DelimiterTests.cs32
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/DetectColumnCountChangesTests.cs20
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/DetectDelimiterTests.cs20
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/DetectDelimiterValuesTests.cs25
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/EncodingTests.cs33
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/EnumIgnoreCaseTests.cs91
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/EscapeTests.cs32
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/ExceptionMessagesContainRawDataTests.cs25
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/FormatTests.cs37
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/HasHeaderRecordTests.cs30
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/HeaderPrefixTests.cs205
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/IgnoreBaseTests.cs71
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/IgnoreBlankLinesTests.cs36
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/IgnoreReferencesTests.cs25
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/IgnoreTests.cs93
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/IncludePrivateMembersTests.cs29
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/IndexTests.cs42
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/InjectionCharactersTests.cs25
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/InjectionEscapeCharacterTests.cs25
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/InjectionOptionsTests.cs25
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/LineBreakInQuotedFieldIsBadDataTests.cs25
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/MaxFieldSizeTests.cs20
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/MemberTypesTests.cs20
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/ModeTests.cs20
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/NameIndexTests.cs37
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/NameTests.cs38
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/NewLineTests.cs20
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/NullValuesTests.cs37
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/NumberStylesTests.cs37
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/OptionalTests.cs41
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/ProcessFieldBufferSizeTests.cs20
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/QuoteTests.cs29
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/ReferenceTests.cs43
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/TrimOptionsTests.cs31
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/TypeConverterTests.cs125
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/UseNewObjectForNullReferenceMembersTests.cs20
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/WhiteSpaceCharsTests.cs20
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/BooleanFalseValuesAttributeTests.cs110
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/BooleanFalseValuesMapTests.cs125
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/BooleanTrueValuesAttributeTests.cs110
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/BooleanTrueValuesMapTests.cs125
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/ConstantAttributeTests.cs109
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/ConstantMapTests.cs193
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/CultureInfoAttributeTests.cs119
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/CultureInfoMapTests.cs160
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/DateTimeStylesAttributeTests.cs109
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/DateTimeStylesMapTests.cs152
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/DefaultAttributeTests.cs108
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/DefaultMapTests.cs152
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/EnumIgnoreCaseTests.cs113
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/FormatAttributeTests.cs111
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/FormatMapTests.cs156
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/HeaderPrefixAttributeTests.cs111
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/HeaderPrefixMapTests.cs6
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/IgnoreAttributeTests.cs106
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/IgnoreMapTests.cs150
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/IndexAttributeTests.cs106
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/IndexMapTests.cs149
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/NameAttributeTests.cs85
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/NameIndexAttributeTests.cs85
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/NameIndexMapTests.cs126
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/NameMapTests.cs126
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/NullValuesAttributeTests.cs107
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/NullValuesMapTests.cs122
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/NumberStylesAttributeTests.cs108
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/NumberStylesMapTests.cs151
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/OptionalAttributeTests.cs106
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/OptionalMapTests.cs150
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/TypeConverterAttributeTests.cs115
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/TypeConverterMapTests.cs158
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/CsvClassMappingTests.cs239
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/FieldMappingTests.cs397
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/HiddenBaseMembersTests.cs117
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/IgnoreHeaderWhiteSpaceTests.cs52
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/MapConstructorTests.cs42
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/MappingWithNoHeaderTests.cs243
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/OptionalTests.cs220
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Property/ConstantTests.cs74
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ReferenceConstructorArgsTests.cs50
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/RuntimeMapping.cs199
-rw-r--r--ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/SubPropertyMappingTests.cs127
90 files changed, 7566 insertions, 0 deletions
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/AllowCommentsTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/AllowCommentsTests.cs
new file mode 100644
index 0000000..e5fb1eb
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/AllowCommentsTests.cs
@@ -0,0 +1,29 @@
+// Copyright 2009-2015 Josh Close and Contributors
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// http://csvhelper.com
+using CsvHelper.Configuration;
+using CsvHelper.Configuration.Attributes;
+using System.Globalization;
+using Xunit;
+
+namespace CsvHelper.Tests.AttributeMapping
+{
+ public class AllowCommentsTests
+ {
+ [Fact]
+ public void AllowCommentsTest()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture, typeof(AllowCommentsTestClass));
+ Assert.True(config.AllowComments);
+ }
+
+ [AllowComments(true)]
+ private class AllowCommentsTestClass
+ {
+ public int Id { get; set; }
+
+ public string Name { get; set; }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/BooleanValuesTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/BooleanValuesTests.cs
new file mode 100644
index 0000000..b2eefde
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/BooleanValuesTests.cs
@@ -0,0 +1,37 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using CsvHelper.Configuration.Attributes;
+using Xunit;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+
+namespace CsvHelper.Tests.Mappings.Attribute
+{
+
+ public class BooleanValuesTests
+ {
+ [Fact]
+ public void BooleanValuesTest()
+ {
+ using (var reader = new StringReader("IsTrue,IsFalse\r\ntrue,false\r\n"))
+ using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
+ {
+ var records = csv.GetRecords<BooleanValuesTestClass>().ToList();
+ Assert.Equal(true, records[0].IsTrue);
+ Assert.Equal(false, records[0].IsFalse);
+ }
+ }
+
+ private class BooleanValuesTestClass
+ {
+ [BooleanTrueValues("true")]
+ public bool? IsTrue { get; set; }
+
+ [BooleanFalseValues("false")]
+ public bool? IsFalse { get; set; }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/BufferSizeTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/BufferSizeTests.cs
new file mode 100644
index 0000000..dd35498
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/BufferSizeTests.cs
@@ -0,0 +1,25 @@
+using CsvHelper.Configuration;
+using CsvHelper.Configuration.Attributes;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace CsvHelper.Tests.Mappings.Attribute
+{
+ public class BufferSizeTests
+ {
+ [Fact]
+ public void ConstructorAttributeTest()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture, typeof(Foo));
+ Assert.Equal(2, config.BufferSize);
+ }
+
+ [BufferSize(2)]
+ private class Foo { }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/CacheFieldsTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/CacheFieldsTests.cs
new file mode 100644
index 0000000..bfc1c52
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/CacheFieldsTests.cs
@@ -0,0 +1,20 @@
+using CsvHelper.Configuration;
+using CsvHelper.Configuration.Attributes;
+using System.Globalization;
+using Xunit;
+
+namespace CsvHelper.Tests.Mappings.Attribute
+{
+ public class CacheFieldsTests
+ {
+ [Fact]
+ public void ConstructorAttributeTest()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture, typeof(Foo));
+ Assert.True(config.CacheFields);
+ }
+
+ [CacheFields(true)]
+ private class Foo { }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/CommentTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/CommentTests.cs
new file mode 100644
index 0000000..64baf14
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/CommentTests.cs
@@ -0,0 +1,28 @@
+// Copyright 2009-2015 Josh Close and Contributors
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// http://csvhelper.com
+using CsvHelper.Configuration;
+using CsvHelper.Configuration.Attributes;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using Xunit;
+
+namespace CsvHelper.Tests.AttributeMapping
+{
+ public class CommentTests
+ {
+ [Fact]
+ public void CommentTest()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture, typeof(CommentTestClass));
+ Assert.Equal('x', config.Comment);
+ }
+
+ [Comment('x')]
+ private class CommentTestClass
+ {
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/ConstantTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/ConstantTests.cs
new file mode 100644
index 0000000..5ab6381
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/ConstantTests.cs
@@ -0,0 +1,50 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using CsvHelper.Configuration.Attributes;
+using Xunit;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+
+namespace CsvHelper.Tests.Mappings.Attribute
+{
+
+ public class ConstantTests
+ {
+ [Fact]
+ public void ConstantTest()
+ {
+ using (var reader = new StringReader("Id,Name\r\n1,one\r\n"))
+ using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
+ {
+ var records = csv.GetRecords<ConstantTestClass>().ToList();
+
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal("two", records[0].Name);
+ }
+ }
+
+ [Fact]
+ public void ConstantOnMissingFieldTest()
+ {
+ using (var reader = new StringReader("Id\r\n1\r\n"))
+ using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
+ {
+ var records = csv.GetRecords<ConstantTestClass>().ToList();
+
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal("two", records[0].Name);
+ }
+ }
+
+ private class ConstantTestClass
+ {
+ public int Id { get; set; }
+
+ [Constant("two")]
+ public string Name { get; set; }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/CountBytesTest.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/CountBytesTest.cs
new file mode 100644
index 0000000..c4847cd
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/CountBytesTest.cs
@@ -0,0 +1,20 @@
+using CsvHelper.Configuration;
+using CsvHelper.Configuration.Attributes;
+using System.Globalization;
+using Xunit;
+
+namespace CsvHelper.Tests.Mappings.Attribute
+{
+ public class CountBytesTest
+ {
+ [Fact]
+ public void ConstructorAttributeTest()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture, typeof(Foo));
+ Assert.True(config.CountBytes);
+ }
+
+ [CountBytes(true)]
+ private class Foo { }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/DateTimeStylesTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/DateTimeStylesTests.cs
new file mode 100644
index 0000000..3e5a25d
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/DateTimeStylesTests.cs
@@ -0,0 +1,37 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using CsvHelper.Configuration.Attributes;
+using Xunit;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+
+namespace CsvHelper.Tests.Mappings.Attribute
+{
+
+ public class DateTimeStylesTests
+ {
+ [Fact]
+ public void DateTimeStylesTest()
+ {
+ using (var reader = new StringReader("Id,Name\r\n1,one\r\n"))
+ using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
+ {
+ var records = csv.GetRecords<DateTimeStylesTestClass>().ToList();
+ var actual = csv.Context.Maps.Find<DateTimeStylesTestClass>().MemberMaps[1].Data.TypeConverterOptions.DateTimeStyle;
+
+ Assert.Equal(DateTimeStyles.AdjustToUniversal, actual);
+ }
+ }
+
+ private class DateTimeStylesTestClass
+ {
+ public int Id { get; set; }
+
+ [DateTimeStyles(DateTimeStyles.AdjustToUniversal)]
+ public string Name { get; set; }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/DefaultTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/DefaultTests.cs
new file mode 100644
index 0000000..4718c66
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/DefaultTests.cs
@@ -0,0 +1,37 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using CsvHelper.Configuration.Attributes;
+using Xunit;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+
+namespace CsvHelper.Tests.Mappings.Attribute
+{
+
+ public class DefaultTests
+ {
+ [Fact]
+ public void DefaultTest()
+ {
+ using (var reader = new StringReader("Id,Name\r\n1,\r\n"))
+ using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
+ {
+ var records = csv.GetRecords<DefaultTestClass>().ToList();
+
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal("one", records[0].Name);
+ }
+ }
+
+ private class DefaultTestClass
+ {
+ public int Id { get; set; }
+
+ [Default("one")]
+ public string Name { get; set; }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/DelimiterTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/DelimiterTests.cs
new file mode 100644
index 0000000..3315126
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/DelimiterTests.cs
@@ -0,0 +1,32 @@
+// Copyright 2009-2015 Josh Close and Contributors
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// http://csvhelper.com
+using CsvHelper.Configuration;
+using CsvHelper.Configuration.Attributes;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using Xunit;
+
+namespace CsvHelper.Tests.AttributeMapping
+{
+ public class DelimiterTests
+ {
+ [Fact]
+ public void DelimiterReaderTest()
+ {
+ var configuration = new CsvConfiguration(CultureInfo.InvariantCulture, typeof(DelimiterTestClass));
+
+ Assert.Equal("§", configuration.Delimiter);
+ }
+
+ [Delimiter("§")]
+ private class DelimiterTestClass
+ {
+ public int Id { get; set; }
+
+ public string Name { get; set; }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/DetectColumnCountChangesTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/DetectColumnCountChangesTests.cs
new file mode 100644
index 0000000..4fad816
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/DetectColumnCountChangesTests.cs
@@ -0,0 +1,20 @@
+using CsvHelper.Configuration;
+using CsvHelper.Configuration.Attributes;
+using System.Globalization;
+using Xunit;
+
+namespace CsvHelper.Tests.Mappings.Attribute
+{
+ public class DetectColumnCountChangesTests
+ {
+ [Fact]
+ public void ConstructorAttributeTest()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture, typeof(Foo));
+ Assert.True(config.DetectColumnCountChanges);
+ }
+
+ [DetectColumnCountChanges(true)]
+ private class Foo { }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/DetectDelimiterTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/DetectDelimiterTests.cs
new file mode 100644
index 0000000..1ccc0fb
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/DetectDelimiterTests.cs
@@ -0,0 +1,20 @@
+using CsvHelper.Configuration;
+using CsvHelper.Configuration.Attributes;
+using System.Globalization;
+using Xunit;
+
+namespace CsvHelper.Tests.Mappings.Attribute
+{
+ public class DetectDelimiterTests
+ {
+ [Fact]
+ public void ConstructorAttributeTest()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture, typeof(Foo));
+ Assert.True(config.DetectDelimiter);
+ }
+
+ [DetectDelimiter(true)]
+ private class Foo { }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/DetectDelimiterValuesTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/DetectDelimiterValuesTests.cs
new file mode 100644
index 0000000..a160001
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/DetectDelimiterValuesTests.cs
@@ -0,0 +1,25 @@
+using CsvHelper.Configuration;
+using CsvHelper.Configuration.Attributes;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace CsvHelper.Tests.Mappings.Attribute
+{
+ public class DetectDelimiterValuesTests
+ {
+ [Fact]
+ public void ConstructorAttributeTest()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture, typeof(Foo));
+ Assert.Equal(new[] { "a", "b" }, config.DetectDelimiterValues);
+ }
+
+ [DetectDelimiterValues("a b")]
+ private class Foo { }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/EncodingTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/EncodingTests.cs
new file mode 100644
index 0000000..557775b
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/EncodingTests.cs
@@ -0,0 +1,33 @@
+// Copyright 2009-2015 Josh Close and Contributors
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// http://csvhelper.com
+using CsvHelper.Configuration;
+using CsvHelper.Configuration.Attributes;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Text;
+using Xunit;
+
+namespace CsvHelper.Tests.AttributeMapping
+{
+ public class EncodingTests
+ {
+ [Fact]
+ public void EncodingTest()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture, typeof(EncodingTestClass));
+
+ Assert.Equal(Encoding.ASCII, config.Encoding);
+ }
+
+ [Encoding("ASCII")]
+ private class EncodingTestClass
+ {
+ public int Id { get; set; }
+
+ public string Name { get; set; }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/EnumIgnoreCaseTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/EnumIgnoreCaseTests.cs
new file mode 100644
index 0000000..e12f3cd
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/EnumIgnoreCaseTests.cs
@@ -0,0 +1,91 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using CsvHelper.Configuration;
+using CsvHelper.Configuration.Attributes;
+using CsvHelper.TypeConversion;
+using Xunit;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CsvHelper.Tests.Mappings.Attribute
+{
+
+ public class EnumIgnoreCaseTests
+ {
+ [Fact]
+ public void GetRecords_UsingEnumIgnoreCaseFromClassMap_ReadsEnumValueWithDifferentCasing()
+ {
+ var s = new StringBuilder();
+ s.Append("Id,Enum\r\n");
+ s.Append("1,one");
+ using (var reader = new StringReader(s.ToString()))
+ using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
+ {
+ csv.Context.RegisterClassMap<FooMap>();
+ var records = csv.GetRecords<Foo>().ToList();
+ }
+ }
+
+ [Fact]
+ public void GetRecords_UsingEnumIgnoreCaseFromAttribute_ReadsEnumValueWithDifferentCasing()
+ {
+ var s = new StringBuilder();
+ s.Append("Id,Enum\r\n");
+ s.Append("1,one");
+ using (var reader = new StringReader(s.ToString()))
+ using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
+ {
+ var records = csv.GetRecords<Bar>().ToList();
+ }
+ }
+
+ [Fact]
+ public void GetRecords_UsingEnumIgnoreCaseFromGlobal_ReadsEnumValueWithDifferentCasing()
+ {
+ var s = new StringBuilder();
+ s.Append("Id,Enum\r\n");
+ s.Append("1,one");
+ using (var reader = new StringReader(s.ToString()))
+ using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
+ {
+ csv.Context.TypeConverterOptionsCache.AddOptions<TestEnum>(new TypeConverterOptions { EnumIgnoreCase = true });
+ var records = csv.GetRecords<Foo>().ToList();
+ }
+ }
+
+ private class Foo
+ {
+ public int Id { get; set; }
+ public TestEnum Enum { get; set; }
+ }
+
+ private class FooMap : ClassMap<Foo>
+ {
+ public FooMap()
+ {
+ Map(m => m.Id);
+ Map(m => m.Enum).TypeConverterOption.EnumIgnoreCase();
+ }
+ }
+
+ private class Bar
+ {
+ public int Id { get; set; }
+ [EnumIgnoreCase]
+ public TestEnum Enum { get; set; }
+ }
+
+ private enum TestEnum
+ {
+ None = 0,
+ One = 1
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/EscapeTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/EscapeTests.cs
new file mode 100644
index 0000000..b3c3e7f
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/EscapeTests.cs
@@ -0,0 +1,32 @@
+// Copyright 2009-2015 Josh Close and Contributors
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// http://csvhelper.com
+using CsvHelper.Configuration;
+using CsvHelper.Configuration.Attributes;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using Xunit;
+
+namespace CsvHelper.Tests.AttributeMapping
+{
+ public class EscapeTests
+ {
+ [Fact]
+ public void EscapeTest()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture, typeof(EscapeTestClass));
+
+ Assert.Equal('x', config.Escape);
+ }
+
+ [Escape('x')]
+ private class EscapeTestClass
+ {
+ public int Id { get; set; }
+
+ public string Name { get; set; }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/ExceptionMessagesContainRawDataTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/ExceptionMessagesContainRawDataTests.cs
new file mode 100644
index 0000000..ce3688e
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/ExceptionMessagesContainRawDataTests.cs
@@ -0,0 +1,25 @@
+using CsvHelper.Configuration;
+using CsvHelper.Configuration.Attributes;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace CsvHelper.Tests.Mappings.Attribute
+{
+ public class ExceptionMessagesContainRawDataTests
+ {
+ [Fact]
+ public void ConstructorAttributeTest()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture, typeof(Foo));
+ Assert.False(config.ExceptionMessagesContainRawData);
+ }
+
+ [ExceptionMessagesContainRawData(false)]
+ private class Foo { }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/FormatTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/FormatTests.cs
new file mode 100644
index 0000000..c2e2b5f
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/FormatTests.cs
@@ -0,0 +1,37 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using CsvHelper.Configuration.Attributes;
+using Xunit;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+
+namespace CsvHelper.Tests.Mappings.Attribute
+{
+
+ public class FormatTests
+ {
+ [Fact]
+ public void FormatTest()
+ {
+ using (var reader = new StringReader("Id,Name\r\n1,one\r\n"))
+ using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
+ {
+ var records = csv.GetRecords<FormatTestClass>().ToList();
+ var actual = csv.Context.Maps.Find<FormatTestClass>().MemberMaps[1].Data.TypeConverterOptions.Formats[0];
+
+ Assert.Equal("abc", actual);
+ }
+ }
+
+ private class FormatTestClass
+ {
+ public int Id { get; set; }
+
+ [Format("abc")]
+ public string Name { get; set; }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/HasHeaderRecordTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/HasHeaderRecordTests.cs
new file mode 100644
index 0000000..9fae872
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/HasHeaderRecordTests.cs
@@ -0,0 +1,30 @@
+// Copyright 2009-2015 Josh Close and Contributors
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// http://csvhelper.com
+using CsvHelper.Configuration;
+using CsvHelper.Configuration.Attributes;
+using System.Globalization;
+using Xunit;
+
+namespace CsvHelper.Tests.AttributeMapping
+{
+ public class HasHeaderRecordTests
+ {
+ [Fact]
+ public void HasHeaderRecordTest()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture, typeof(HasHeaderRecordTestClass));
+
+ Assert.False(config.HasHeaderRecord);
+ }
+
+ [HasHeaderRecord(false)]
+ private class HasHeaderRecordTestClass
+ {
+ public int Id { get; set; }
+
+ public string Name { get; set; }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/HeaderPrefixTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/HeaderPrefixTests.cs
new file mode 100644
index 0000000..fe5cb61
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/HeaderPrefixTests.cs
@@ -0,0 +1,205 @@
+using CsvHelper.Configuration;
+using CsvHelper.Configuration.Attributes;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace CsvHelper.Tests.Mappings.Attribute
+{
+ public class HeaderPrefixTests
+ {
+ [Fact]
+ public void WriteHeader_PrefixCustom_WritesCustomPrefixesOwnLevelOnly()
+ {
+ using (var writer = new StringWriter())
+ using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+ {
+ csv.WriteHeader<ACustom>();
+ csv.Flush();
+
+ Assert.Equal("AId,b_BId,c_CId", writer.ToString());
+ }
+ }
+
+ [Fact]
+ public void WriteHeader_PrefixInherit_WritesPrefixesForEachLevel()
+ {
+ using (var writer = new StringWriter())
+ using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+ {
+ csv.WriteHeader<AInherit>();
+ csv.Flush();
+
+ Assert.Equal("AId,B.BId,B.C.CId", writer.ToString());
+ }
+ }
+
+ [Fact]
+ public void WriteHeader_PrefixNoInherit_WritesPrefixesOwnLevelOnly()
+ {
+ using (var writer = new StringWriter())
+ using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+ {
+ csv.WriteHeader<ANoInherit>();
+ csv.Flush();
+
+ Assert.Equal("AId,B.BId,C.CId", writer.ToString());
+ }
+ }
+
+ [Fact]
+ public void WriteHeader_PrefixDefaultInherit_WritesPrefixesOwnLevelOnly()
+ {
+ using (var writer = new StringWriter())
+ using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+ {
+ csv.WriteHeader<ADefaultInherit>();
+ csv.Flush();
+
+ Assert.Equal("AId,B.BId,C.CId", writer.ToString());
+ }
+ }
+
+ [Fact]
+ public void GetRecords_PrefixCustom_ReadsCustomHeader()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture);
+ var s = new TestStringBuilder(config.NewLine);
+ s.AppendLine("AId,b_BId,c_CId");
+ s.AppendLine("aid,bid,cid");
+ using (var reader = new StringReader(s))
+ using (var csv = new CsvReader(reader, config))
+ {
+ var records = csv.GetRecords<ACustom>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal("aid", records[0].AId);
+ Assert.Equal("bid", records[0].B.BId);
+ Assert.Equal("cid", records[0].B.C.CId);
+ }
+ }
+
+ [Fact]
+ public void GetRecords_PrefixInherit_ReadsInheritedHeader()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture);
+ var s = new TestStringBuilder(config.NewLine);
+ s.AppendLine("AId,B.BId,B.C.CId");
+ s.AppendLine("aid,bid,cid");
+ using (var reader = new StringReader(s))
+ using (var csv = new CsvReader(reader, config))
+ {
+ var records = csv.GetRecords<AInherit>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal("aid", records[0].AId);
+ Assert.Equal("bid", records[0].B.BId);
+ Assert.Equal("cid", records[0].B.C.CId);
+ }
+ }
+
+ [Fact]
+ public void GetRecords_PrefixNoInherit_ReadsNonInheritedHeader()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture);
+ var s = new TestStringBuilder(config.NewLine);
+ s.AppendLine("AId,B.BId,C.CId");
+ s.AppendLine("aid,bid,cid");
+ using (var reader = new StringReader(s))
+ using (var csv = new CsvReader(reader, config))
+ {
+ var records = csv.GetRecords<ANoInherit>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal("bid", records[0].B.BId);
+ Assert.Equal("aid", records[0].AId);
+ Assert.Equal("cid", records[0].B.C.CId);
+ }
+ }
+
+ [Fact]
+ public void GetRecords_PrefixDefaultInherit_ReadsNonInheritedHeader()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture);
+ var s = new TestStringBuilder(config.NewLine);
+ s.AppendLine("AId,B.BId,C.CId");
+ s.AppendLine("aid,bid,cid");
+ using (var reader = new StringReader(s))
+ using (var csv = new CsvReader(reader, config))
+ {
+ var records = csv.GetRecords<ADefaultInherit>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal("aid", records[0].AId);
+ Assert.Equal("bid", records[0].B.BId);
+ Assert.Equal("cid", records[0].B.C.CId);
+ }
+ }
+
+ private class ACustom
+ {
+ public string AId { get; set; }
+ [HeaderPrefix("b_")]
+ public BCustom B { get; set; }
+ }
+
+ private class BCustom
+ {
+ public string BId { get; set; }
+ [HeaderPrefix("c_")]
+ public C C { get; set; }
+ }
+
+ private class AInherit
+ {
+ public string AId { get; set; }
+ [HeaderPrefix(true)]
+ public BInherit B { get; set; }
+ }
+
+ private class BInherit
+ {
+ public string BId { get; set; }
+ [HeaderPrefix(true)]
+ public C C { get; set; }
+ }
+
+ private class ANoInherit
+ {
+ public string AId { get; set; }
+ [HeaderPrefix(false)]
+ public BInherit B { get; set; }
+ }
+
+ private class BNoInherit
+ {
+ public string BId { get; set; }
+ [HeaderPrefix(false)]
+ public C C { get; set; }
+ }
+
+ private class ADefaultInherit
+ {
+ public string AId { get; set; }
+ [HeaderPrefix]
+ public BInherit B { get; set; }
+ }
+
+ private class BDefaultInherit
+ {
+ public string BId { get; set; }
+ [HeaderPrefix]
+ public C C { get; set; }
+ }
+
+ private class C
+ {
+ public string CId { get; set; }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/IgnoreBaseTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/IgnoreBaseTests.cs
new file mode 100644
index 0000000..9f49082
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/IgnoreBaseTests.cs
@@ -0,0 +1,71 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using CsvHelper.Configuration;
+using CsvHelper.Configuration.Attributes;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace CsvHelper.Tests.Mappings.Attribute
+{
+ public class IgnoreBaseTests
+ {
+ [Fact]
+ public void GetRecordsWithProperties_IgnoreBaseAttribute_DoesNotMapBaseClass()
+ {
+ var map = new DefaultClassMap<ChildProperties>();
+ map.AutoMap(CultureInfo.InvariantCulture);
+
+ Assert.Single(map.MemberMaps);
+ Assert.Null(map.MemberMaps.Find<ChildProperties>(m => m.Id));
+ Assert.NotNull(map.MemberMaps.Find<ChildProperties>(m => m.Name));
+ }
+
+ [Fact]
+ public void GetRecordsWithFields_IgnoreBaseAttribute_DoesNotMapBaseClass()
+ {
+ var map = new DefaultClassMap<ChildFields>();
+ map.AutoMap(new CsvConfiguration(CultureInfo.InvariantCulture)
+ {
+ MemberTypes = MemberTypes.Fields,
+ });
+
+ Assert.Single(map.MemberMaps);
+ Assert.Null(map.MemberMaps.Find<ChildFields>(m => m.Id));
+ Assert.NotNull(map.MemberMaps.Find<ChildFields>(m => m.Name));
+ }
+
+ private class ParentProperties
+ {
+ public int Id { get; set; }
+ }
+
+ [IgnoreBase]
+ private class ChildProperties : ParentProperties
+ {
+ public string Name { get; set; }
+ }
+
+ private class ParentFields
+ {
+#pragma warning disable CS0649
+ public int Id;
+#pragma warning restore CS0649
+ }
+
+ [IgnoreBase]
+ private class ChildFields: ParentFields
+ {
+#pragma warning disable CS0649
+ public string Name;
+#pragma warning restore CS0649
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/IgnoreBlankLinesTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/IgnoreBlankLinesTests.cs
new file mode 100644
index 0000000..b2ec8e0
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/IgnoreBlankLinesTests.cs
@@ -0,0 +1,36 @@
+// Copyright 2009-2015 Josh Close and Contributors
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// http://csvhelper.com
+using CsvHelper.Configuration.Attributes;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using Xunit;
+
+namespace CsvHelper.Tests.AttributeMapping
+{
+ public class IgnoreBlankLinesTests
+ {
+ [Fact]
+ public void IgnoreBlankLinesTest()
+ {
+ using (var reader = new StringReader("Id,Name\r\n1,one\r\n"))
+ using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
+ {
+ var records = csv.GetRecords<IgnoreBlankLinesTestClass>().ToList();
+ var actual = csv.Configuration.IgnoreBlankLines;
+
+ Assert.True(actual);
+ }
+ }
+
+ [IgnoreBlankLines(true)]
+ private class IgnoreBlankLinesTestClass
+ {
+ public int Id { get; set; }
+
+ public string Name { get; set; }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/IgnoreReferencesTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/IgnoreReferencesTests.cs
new file mode 100644
index 0000000..f2839b6
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/IgnoreReferencesTests.cs
@@ -0,0 +1,25 @@
+using CsvHelper.Configuration;
+using CsvHelper.Configuration.Attributes;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace CsvHelper.Tests.Mappings.Attribute
+{
+ public class IgnoreReferencesTests
+ {
+ [Fact]
+ public void ConstructorAttributeTest()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture, typeof(Foo));
+ Assert.True(config.IgnoreReferences);
+ }
+
+ [IgnoreReferences(true)]
+ private class Foo { }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/IgnoreTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/IgnoreTests.cs
new file mode 100644
index 0000000..4849ad1
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/IgnoreTests.cs
@@ -0,0 +1,93 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using Xunit;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Text;
+
+namespace CsvHelper.Tests.Mappings.Attribute
+{
+
+ public class IgnoreTests
+ {
+ [Fact]
+ public void IgnoreTest()
+ {
+ using (var reader = new StringReader("Id,Name\r\n1,one\r\n"))
+ using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
+ {
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal("one", records[0].Name);
+ }
+ }
+
+ [Fact]
+ public void IgnoreReferenceTest()
+ {
+ var records = new List<Parent>
+ {
+ new Parent
+ {
+ Id = 1,
+ Child = new Child
+ {
+ Name = "one",
+ GrandChild = new GrandChild
+ {
+ Date = DateTimeOffset.Now
+ }
+ }
+ }
+ };
+
+ using (var writer = new StringWriter())
+ using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+ {
+ csv.WriteRecords(records);
+
+ var expected = new TestStringBuilder(csv.Configuration.NewLine);
+ expected.AppendLine("Id");
+ expected.AppendLine("1");
+
+ Assert.Equal(expected.ToString(), writer.ToString());
+ }
+ }
+
+ private class Foo
+ {
+ public int Id { get; set; }
+
+ public string Name { get; set; }
+
+ [CsvHelper.Configuration.Attributes.Ignore]
+ public DateTime Date { get; set; }
+ }
+
+ private class Parent
+ {
+ public int Id { get; set; }
+
+ [CsvHelper.Configuration.Attributes.Ignore]
+ public Child Child { get; set; }
+ }
+
+ private class Child
+ {
+ public string Name { get; set; }
+
+ public GrandChild GrandChild { get; set; }
+ }
+
+ private class GrandChild
+ {
+ public DateTimeOffset Date { get; set; }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/IncludePrivateMembersTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/IncludePrivateMembersTests.cs
new file mode 100644
index 0000000..2b219dc
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/IncludePrivateMembersTests.cs
@@ -0,0 +1,29 @@
+// Copyright 2009-2015 Josh Close and Contributors
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// http://csvhelper.com
+using CsvHelper.Configuration;
+using CsvHelper.Configuration.Attributes;
+using System.Globalization;
+using Xunit;
+
+namespace CsvHelper.Tests.AttributeMapping
+{
+ public class IncludePrivateMembersTests
+ {
+ [Fact]
+ public void TrimOptionsTest()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture, typeof(IncludePrivateMembersTestClass));
+ Assert.True(config.IncludePrivateMembers);
+ }
+
+ [IncludePrivateMembers(true)]
+ private class IncludePrivateMembersTestClass
+ {
+ public int Id { get; set; }
+
+ public string Name { get; set; }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/IndexTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/IndexTests.cs
new file mode 100644
index 0000000..1dc9112
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/IndexTests.cs
@@ -0,0 +1,42 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using CsvHelper.Configuration;
+using CsvHelper.Configuration.Attributes;
+using Xunit;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+
+namespace CsvHelper.Tests.Mappings.Attribute
+{
+ public class IndexTests
+ {
+ [Fact]
+ public void IndexTest()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture)
+ {
+ HasHeaderRecord = false,
+ };
+ using (var reader = new StringReader("a,1,b,one,c\r\n"))
+ using (var csv = new CsvReader(reader, config))
+ {
+ var records = csv.GetRecords<IndexTestClass>().ToList();
+
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal("one", records[0].Name);
+ }
+ }
+
+ private class IndexTestClass
+ {
+ [Index(1)]
+ public int Id { get; set; }
+
+ [Index(3)]
+ public string Name { get; set; }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/InjectionCharactersTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/InjectionCharactersTests.cs
new file mode 100644
index 0000000..b4fc82c
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/InjectionCharactersTests.cs
@@ -0,0 +1,25 @@
+using CsvHelper.Configuration;
+using CsvHelper.Configuration.Attributes;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace CsvHelper.Tests.Mappings.Attribute
+{
+ public class InjectionCharactersTests
+ {
+ [Fact]
+ public void ConstructorAttributeTest()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture, typeof(Foo));
+ Assert.Equal(new[] { 'a', 'b' }, config.InjectionCharacters);
+ }
+
+ [InjectionCharacters("a b")]
+ private class Foo { }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/InjectionEscapeCharacterTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/InjectionEscapeCharacterTests.cs
new file mode 100644
index 0000000..e118ea2
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/InjectionEscapeCharacterTests.cs
@@ -0,0 +1,25 @@
+using CsvHelper.Configuration;
+using CsvHelper.Configuration.Attributes;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace CsvHelper.Tests.Mappings.Attribute
+{
+ public class InjectionEscapeCharacterTests
+ {
+ [Fact]
+ public void ConstructorAttributeTest()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture, typeof(Foo));
+ Assert.Equal('a', config.InjectionEscapeCharacter);
+ }
+
+ [InjectionEscapeCharacter('a')]
+ private class Foo { }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/InjectionOptionsTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/InjectionOptionsTests.cs
new file mode 100644
index 0000000..7a03003
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/InjectionOptionsTests.cs
@@ -0,0 +1,25 @@
+using CsvHelper.Configuration;
+using CsvHelper.Configuration.Attributes;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace CsvHelper.Tests.Mappings.Attribute
+{
+ public class InjectionOptionsTests
+ {
+ [Fact]
+ public void ConstructorAttributeTest()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture, typeof(Foo));
+ Assert.Equal(InjectionOptions.Escape, config.InjectionOptions);
+ }
+
+ [InjectionOptions(InjectionOptions.Escape)]
+ private class Foo { }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/LineBreakInQuotedFieldIsBadDataTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/LineBreakInQuotedFieldIsBadDataTests.cs
new file mode 100644
index 0000000..b939780
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/LineBreakInQuotedFieldIsBadDataTests.cs
@@ -0,0 +1,25 @@
+using CsvHelper.Configuration;
+using CsvHelper.Configuration.Attributes;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace CsvHelper.Tests.Mappings.Attribute
+{
+ public class LineBreakInQuotedFieldIsBadDataTests
+ {
+ [Fact]
+ public void ConstructorAttributeTest()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture, typeof(Foo));
+ Assert.True(config.LineBreakInQuotedFieldIsBadData);
+ }
+
+ [LineBreakInQuotedFieldIsBadData(true)]
+ private class Foo { }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/MaxFieldSizeTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/MaxFieldSizeTests.cs
new file mode 100644
index 0000000..b0a9231
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/MaxFieldSizeTests.cs
@@ -0,0 +1,20 @@
+using CsvHelper.Configuration;
+using CsvHelper.Configuration.Attributes;
+using System.Globalization;
+using Xunit;
+
+namespace CsvHelper.Tests.Mappings.Attribute
+{
+ public class MaxFieldSizeTests
+ {
+ [Fact]
+ public void ConstructorAttributeTest()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture, typeof(Foo));
+ Assert.Equal(2, config.MaxFieldSize);
+ }
+
+ [MaxFieldSize(2)]
+ private class Foo { }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/MemberTypesTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/MemberTypesTests.cs
new file mode 100644
index 0000000..be21b32
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/MemberTypesTests.cs
@@ -0,0 +1,20 @@
+using CsvHelper.Configuration;
+using CsvHelper.Configuration.Attributes;
+using System.Globalization;
+using Xunit;
+
+namespace CsvHelper.Tests.Mappings.Attribute
+{
+ public class MemberTypesTests
+ {
+ [Fact]
+ public void ConstructorAttributeTest()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture, typeof(Foo));
+ Assert.Equal(MemberTypes.Fields, config.MemberTypes);
+ }
+
+ [MemberTypes(MemberTypes.Fields)]
+ private class Foo { }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/ModeTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/ModeTests.cs
new file mode 100644
index 0000000..ca35863
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/ModeTests.cs
@@ -0,0 +1,20 @@
+using CsvHelper.Configuration;
+using CsvHelper.Configuration.Attributes;
+using System.Globalization;
+using Xunit;
+
+namespace CsvHelper.Tests.Mappings.Attribute
+{
+ public class ModeTests
+ {
+ [Fact]
+ public void ConstructorAttributeTest()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture, typeof(Foo));
+ Assert.Equal(CsvMode.Escape, config.Mode);
+ }
+
+ [Mode(CsvMode.Escape)]
+ private class Foo { }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/NameIndexTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/NameIndexTests.cs
new file mode 100644
index 0000000..07cda20
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/NameIndexTests.cs
@@ -0,0 +1,37 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using CsvHelper.Configuration.Attributes;
+using Xunit;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+
+namespace CsvHelper.Tests.Mappings.Attribute
+{
+
+ public class NameIndexTests
+ {
+ [Fact]
+ public void NameIndexTest()
+ {
+ using (var reader = new StringReader("Id,Name,Name\r\n1,one,two\r\n"))
+ using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
+ {
+ var records = csv.GetRecords<NameIndexClass>().ToList();
+
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal("two", records[0].Name);
+ }
+ }
+
+ private class NameIndexClass
+ {
+ public int Id { get; set; }
+
+ [NameIndex(1)]
+ public string Name { get; set; }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/NameTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/NameTests.cs
new file mode 100644
index 0000000..3957442
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/NameTests.cs
@@ -0,0 +1,38 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using CsvHelper.Configuration.Attributes;
+using Xunit;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+
+namespace CsvHelper.Tests.Mappings.Attribute
+{
+
+ public class NameTests
+ {
+ [Fact]
+ public void NameTest()
+ {
+ using (var reader = new StringReader("id,name\r\n1,one\r\n"))
+ using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
+ {
+ var records = csv.GetRecords<NameTestClass>().ToList();
+
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal("one", records[0].Name);
+ }
+ }
+
+ private class NameTestClass
+ {
+ [Name("id")]
+ public int Id { get; set; }
+
+ [Name("name")]
+ public string Name { get; set; }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/NewLineTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/NewLineTests.cs
new file mode 100644
index 0000000..5d9ba80
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/NewLineTests.cs
@@ -0,0 +1,20 @@
+using CsvHelper.Configuration;
+using CsvHelper.Configuration.Attributes;
+using System.Globalization;
+using Xunit;
+
+namespace CsvHelper.Tests.Mappings.Attribute
+{
+ public class NewLineTests
+ {
+ [Fact]
+ public void ConstructorAttributeTest()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture, typeof(Foo));
+ Assert.Equal("a", config.NewLine);
+ }
+
+ [NewLine("a")]
+ private class Foo { }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/NullValuesTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/NullValuesTests.cs
new file mode 100644
index 0000000..8694172
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/NullValuesTests.cs
@@ -0,0 +1,37 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using CsvHelper.Configuration.Attributes;
+using Xunit;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+
+namespace CsvHelper.Tests.Mappings.Attribute
+{
+
+ public class NullValuesTests
+ {
+ [Fact]
+ public void NullValuesTest()
+ {
+ using (var reader = new StringReader("Id,Name\r\nNULL,null\r\n"))
+ using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
+ {
+ var records = csv.GetRecords<NullValuesTestClass>().ToList();
+ Assert.Null(records[0].Id);
+ Assert.Null(records[0].Name);
+ }
+ }
+
+ private class NullValuesTestClass
+ {
+ [NullValues("NULL")]
+ public int? Id { get; set; }
+
+ [NullValues("null")]
+ public string Name { get; set; }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/NumberStylesTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/NumberStylesTests.cs
new file mode 100644
index 0000000..3740f54
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/NumberStylesTests.cs
@@ -0,0 +1,37 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using CsvHelper.Configuration.Attributes;
+using Xunit;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+
+namespace CsvHelper.Tests.Mappings.Attribute
+{
+
+ public class NumberStylesTests
+ {
+ [Fact]
+ public void DateTimeStylesTest()
+ {
+ using (var reader = new StringReader("Id,Name\r\n1,one\r\n"))
+ using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
+ {
+ var records = csv.GetRecords<NumberStylesTestClass>().ToList();
+ var actual = csv.Context.Maps.Find<NumberStylesTestClass>().MemberMaps[1].Data.TypeConverterOptions.NumberStyles;
+
+ Assert.Equal(NumberStyles.AllowCurrencySymbol, actual);
+ }
+ }
+
+ private class NumberStylesTestClass
+ {
+ public int Id { get; set; }
+
+ [NumberStyles(NumberStyles.AllowCurrencySymbol)]
+ public string Name { get; set; }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/OptionalTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/OptionalTests.cs
new file mode 100644
index 0000000..466e6b5
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/OptionalTests.cs
@@ -0,0 +1,41 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using CsvHelper.Configuration.Attributes;
+using CsvHelper.Tests.Mocks;
+using Xunit;
+using System.Linq;
+
+namespace CsvHelper.Tests.Mappings.Attribute
+{
+
+ public class OptionalTests
+ {
+ [Fact]
+ public void OptionalTest()
+ {
+ var parser = new ParserMock
+ {
+ { "Id" },
+ { "1" },
+ };
+
+ using (var csv = new CsvReader(parser))
+ {
+ var records = csv.GetRecords<OptionalTestClass>().ToList();
+
+ Assert.Equal(1, records[0].Id);
+ Assert.Null(records[0].Name);
+ }
+ }
+
+ private class OptionalTestClass
+ {
+ public int Id { get; set; }
+
+ [Optional]
+ public string Name { get; set; }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/ProcessFieldBufferSizeTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/ProcessFieldBufferSizeTests.cs
new file mode 100644
index 0000000..63ea433
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/ProcessFieldBufferSizeTests.cs
@@ -0,0 +1,20 @@
+using CsvHelper.Configuration;
+using CsvHelper.Configuration.Attributes;
+using System.Globalization;
+using Xunit;
+
+namespace CsvHelper.Tests.Mappings.Attribute
+{
+ public class ProcessFieldBufferSizeTests
+ {
+ [Fact]
+ public void ConstructorAttributeTest()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture, typeof(Foo));
+ Assert.Equal(2, config.ProcessFieldBufferSize);
+ }
+
+ [ProcessFieldBufferSize(2)]
+ private class Foo { }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/QuoteTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/QuoteTests.cs
new file mode 100644
index 0000000..3b6fb41
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/QuoteTests.cs
@@ -0,0 +1,29 @@
+// Copyright 2009-2015 Josh Close and Contributors
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// http://csvhelper.com
+using CsvHelper.Configuration;
+using CsvHelper.Configuration.Attributes;
+using System.Globalization;
+using Xunit;
+
+namespace CsvHelper.Tests.AttributeMapping
+{
+ public class QuoteTests
+ {
+ [Fact]
+ public void QuoteTest()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture, typeof(QuoteTestClass));
+ Assert.Equal('x', config.Quote);
+ }
+
+ [Quote('x')]
+ private class QuoteTestClass
+ {
+ public int Id { get; set; }
+
+ public string Name { get; set; }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/ReferenceTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/ReferenceTests.cs
new file mode 100644
index 0000000..97c64a0
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/ReferenceTests.cs
@@ -0,0 +1,43 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using CsvHelper.Configuration.Attributes;
+using Xunit;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+
+namespace CsvHelper.Tests.Mappings.Attribute
+{
+
+ public class ReferenceTests
+ {
+ [Fact]
+ public void ReferenceTest()
+ {
+ using (var reader = new StringReader("id,name\r\n1,one\r\n"))
+ using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
+ {
+ var records = csv.GetRecords<ReferenceTestClassA>().ToList();
+
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal("one", records[0].B.Name);
+ }
+ }
+
+ private class ReferenceTestClassA
+ {
+ [Name("id")]
+ public int Id { get; set; }
+
+ public ReferenceTestClassB B { get; set; }
+ }
+
+ private class ReferenceTestClassB
+ {
+ [Name("name")]
+ public string Name { get; set; }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/TrimOptionsTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/TrimOptionsTests.cs
new file mode 100644
index 0000000..6e7595f
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/TrimOptionsTests.cs
@@ -0,0 +1,31 @@
+// Copyright 2009-2015 Josh Close and Contributors
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// http://csvhelper.com
+using CsvHelper.Configuration;
+using CsvHelper.Configuration.Attributes;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using Xunit;
+
+namespace CsvHelper.Tests.AttributeMapping
+{
+ public class TrimOptionsTests
+ {
+ [Fact]
+ public void TrimOptionsTest()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture, typeof(TrimOptionsTestClass));
+ Assert.Equal(TrimOptions.InsideQuotes, config.TrimOptions);
+ }
+
+ [TrimOptions(TrimOptions.InsideQuotes)]
+ private class TrimOptionsTestClass
+ {
+ public int Id { get; set; }
+
+ public string Name { get; set; }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/TypeConverterTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/TypeConverterTests.cs
new file mode 100644
index 0000000..afa2cd9
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/TypeConverterTests.cs
@@ -0,0 +1,125 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using CsvHelper.Configuration;
+using CsvHelper.Configuration.Attributes;
+using CsvHelper.TypeConversion;
+using Xunit;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+
+namespace CsvHelper.Tests.Mappings.Attribute
+{
+
+ public class TypeConverterTests
+ {
+ [Fact]
+ public void TypeConverterTest()
+ {
+ using (var reader = new StringReader("Id,Name\r\n1,one\r\n"))
+ using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
+ {
+ var records = csv.GetRecords<TypeConverterClass>().ToList();
+
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal("two", records[0].Name);
+ }
+ }
+
+ [Fact]
+ public void TypeConverterOnClassReferenceTest()
+ {
+ var records = new List<AClass>
+ {
+ new AClass { Id = 1, Name = new BClass() },
+ };
+ using (var writer = new StringWriter())
+ using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+ {
+ csv.WriteRecords(records);
+
+ var expected = "Id,Name\r\n1,two\r\n";
+
+ Assert.Equal(expected, writer.ToString());
+ }
+ }
+
+ [Fact]
+ public void TypeConverterOnStructReferenceTest()
+ {
+ var records = new List<AStruct>
+ {
+ new AStruct { Id = 1, Name = new BStruct() },
+ };
+ using (var writer = new StringWriter())
+ using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+ {
+ csv.WriteRecords(records);
+
+ var expected = "Id,Name\r\n1,two\r\n";
+
+ Assert.Equal(expected, writer.ToString());
+ }
+ }
+
+ [Fact]
+ public void Constructor_TypeConverterWithConstructorArgs_Creates()
+ {
+ var attribute = new TypeConverterAttribute(typeof(TypeConverterWithConstructorArgs), 2);
+ Assert.IsType<TypeConverterWithConstructorArgs>(attribute.TypeConverter);
+ Assert.Equal(2, ((TypeConverterWithConstructorArgs)attribute.TypeConverter).Value);
+ }
+
+ private class TypeConverterClass
+ {
+ public int Id { get; set; }
+
+ [TypeConverter(typeof(StringTypeConverter))]
+ public string Name { get; set; }
+ }
+
+ private class StringTypeConverter : ITypeConverter
+ {
+ public object ConvertFromString(string text, IReaderRow row, MemberMapData memberMapData)
+ {
+ return "two";
+ }
+
+ public string ConvertToString(object value, IWriterRow row, MemberMapData memberMapData)
+ {
+ return "two";
+ }
+ }
+
+ private class AClass
+ {
+ public int Id { get; set; }
+ [TypeConverter(typeof(StringTypeConverter))]
+ public BClass Name { get; set; }
+ }
+
+ private class BClass { }
+
+ private class AStruct
+ {
+ public int Id { get; set; }
+ [TypeConverter(typeof(StringTypeConverter))]
+ public BStruct Name { get; set; }
+ }
+
+ private class BStruct { }
+
+ private class TypeConverterWithConstructorArgs : DefaultTypeConverter
+ {
+ public int Value { get; private set; }
+
+ public TypeConverterWithConstructorArgs(int value)
+ {
+ Value = value;
+ }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/UseNewObjectForNullReferenceMembersTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/UseNewObjectForNullReferenceMembersTests.cs
new file mode 100644
index 0000000..d560872
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/UseNewObjectForNullReferenceMembersTests.cs
@@ -0,0 +1,20 @@
+using CsvHelper.Configuration;
+using CsvHelper.Configuration.Attributes;
+using System.Globalization;
+using Xunit;
+
+namespace CsvHelper.Tests.Mappings.Attribute
+{
+ public class UseNewObjectForNullReferenceMembersTests
+ {
+ [Fact]
+ public void ConstructorAttributeTest()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture, typeof(Foo));
+ Assert.False(config.UseNewObjectForNullReferenceMembers);
+ }
+
+ [UseNewObjectForNullReferenceMembers(false)]
+ private class Foo { }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/WhiteSpaceCharsTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/WhiteSpaceCharsTests.cs
new file mode 100644
index 0000000..3abb027
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Attribute/WhiteSpaceCharsTests.cs
@@ -0,0 +1,20 @@
+using CsvHelper.Configuration;
+using CsvHelper.Configuration.Attributes;
+using System.Globalization;
+using Xunit;
+
+namespace CsvHelper.Tests.Mappings.Attribute
+{
+ public class WhiteSpaceCharsTests
+ {
+ [Fact]
+ public void ConstructorAttributeTest()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture, typeof(Foo));
+ Assert.Equal(new[] { 'a', 'b' }, config.WhiteSpaceChars);
+ }
+
+ [WhiteSpaceChars("a b")]
+ private class Foo { }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/BooleanFalseValuesAttributeTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/BooleanFalseValuesAttributeTests.cs
new file mode 100644
index 0000000..d05b601
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/BooleanFalseValuesAttributeTests.cs
@@ -0,0 +1,110 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using CsvHelper.Configuration;
+using CsvHelper.Configuration.Attributes;
+using CsvHelper.Tests.Mocks;
+using Xunit;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CsvHelper.Tests.Mappings.ConstructorParameter
+{
+
+ public class BooleanFalseValuesAttributeTests
+ {
+ [Fact]
+ public void AutoMap_WithBooleanFalseValuesAttribute_CreatesParameterMaps()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture);
+ var context = new CsvContext(config);
+ var map = context.AutoMap<Foo>();
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.Empty(map.ParameterMaps[0].Data.TypeConverterOptions.BooleanTrueValues);
+ Assert.Empty(map.ParameterMaps[0].Data.TypeConverterOptions.BooleanFalseValues);
+ Assert.Empty(map.ParameterMaps[1].Data.TypeConverterOptions.BooleanTrueValues);
+ Assert.Single(map.ParameterMaps[1].Data.TypeConverterOptions.BooleanFalseValues);
+ Assert.Equal("Bar", map.ParameterMaps[1].Data.TypeConverterOptions.BooleanFalseValues[0]);
+ }
+
+ [Fact]
+ public void GetRecords_WithBooleanFalseValuesAttribute_HasHeader_CreatesRecords()
+ {
+ var parser = new ParserMock
+ {
+ { "id", "boolean" },
+ { "1", "Bar" },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.False(records[0].Boolean);
+ }
+ }
+
+ [Fact]
+ public void GetRecords_WithBooleanFalseValuesAttribute_NoHeader_CreatesRecords()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture)
+ {
+ HasHeaderRecord = false,
+ };
+ var parser = new ParserMock(config)
+ {
+ { "1", "Bar" },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.False(records[0].Boolean);
+ }
+ }
+
+ [Fact]
+ public void WriteRecords_WithBooleanFalseValuesAttribute_DoesntUseParameterMaps()
+ {
+ var records = new List<Foo>
+ {
+ new Foo(1, false),
+ };
+
+ using (var writer = new StringWriter())
+ using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+ {
+ csv.WriteRecords(records);
+
+ var expected = new StringBuilder();
+ expected.Append("Id,Boolean\r\n");
+ expected.Append("1,False\r\n");
+
+ Assert.Equal(expected.ToString(), writer.ToString());
+ }
+ }
+
+ private class Foo
+ {
+ public int Id { get; private set; }
+
+ public bool Boolean { get; private set; }
+
+ public Foo(int id, [BooleanFalseValues("Bar")] bool boolean)
+ {
+ Id = id;
+ Boolean = boolean;
+ }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/BooleanFalseValuesMapTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/BooleanFalseValuesMapTests.cs
new file mode 100644
index 0000000..c477a17
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/BooleanFalseValuesMapTests.cs
@@ -0,0 +1,125 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using CsvHelper.Configuration;
+using CsvHelper.Configuration.Attributes;
+using CsvHelper.Tests.Mocks;
+using Xunit;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CsvHelper.Tests.Mappings.ConstructorParameter
+{
+
+ public class BooleanFalseValuesMapTests
+ {
+ [Fact]
+ public void AutoMap_WithBooleanFalseValuesAttribute_CreatesParameterMaps()
+ {
+ var map = new DefaultClassMap<Foo>();
+ map.Parameter("id");
+ map.Parameter("boolean").TypeConverterOption.BooleanValues(false, true, "Bar");
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.Empty(map.ParameterMaps[0].Data.TypeConverterOptions.BooleanTrueValues);
+ Assert.Empty(map.ParameterMaps[0].Data.TypeConverterOptions.BooleanFalseValues);
+ Assert.Empty(map.ParameterMaps[1].Data.TypeConverterOptions.BooleanTrueValues);
+ Assert.Single(map.ParameterMaps[1].Data.TypeConverterOptions.BooleanFalseValues);
+ Assert.Equal("Bar", map.ParameterMaps[1].Data.TypeConverterOptions.BooleanFalseValues[0]);
+ }
+
+ [Fact]
+ public void GetRecords_WithBooleanFalseValuesAttribute_HasHeader_CreatesRecords()
+ {
+ var parser = new ParserMock
+ {
+ { "id", "boolean" },
+ { "1", "Bar" },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ csv.Context.RegisterClassMap<FooMap>();
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.False(records[0].Boolean);
+ }
+ }
+
+ [Fact]
+ public void GetRecords_WithBooleanFalseValuesAttribute_NoHeader_CreatesRecords()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture)
+ {
+ HasHeaderRecord = false,
+ };
+ var parser = new ParserMock(config)
+ {
+ { "1", "Bar" },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ csv.Context.RegisterClassMap<FooMap>();
+
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.False(records[0].Boolean);
+ }
+ }
+
+ [Fact]
+ public void WriteRecords_WithBooleanFalseValuesAttribute_DoesntUseParameterMaps()
+ {
+ var records = new List<Foo>
+ {
+ new Foo(1, false),
+ };
+
+ using (var writer = new StringWriter())
+ using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+ {
+ csv.Context.RegisterClassMap<FooMap>();
+ csv.WriteRecords(records);
+
+ var expected = new StringBuilder();
+ expected.Append("Id,Boolean\r\n");
+ expected.Append("1,False\r\n");
+
+ Assert.Equal(expected.ToString(), writer.ToString());
+ }
+ }
+
+ private class Foo
+ {
+ public int Id { get; private set; }
+
+ public bool Boolean { get; private set; }
+
+ public Foo(int id, bool boolean)
+ {
+ Id = id;
+ Boolean = boolean;
+ }
+ }
+
+ private class FooMap : ClassMap<Foo>
+ {
+ public FooMap()
+ {
+ Map(m => m.Id);
+ Map(m => m.Boolean);
+ Parameter("id");
+ Parameter("boolean").TypeConverterOption.BooleanValues(false, true, "Bar");
+ }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/BooleanTrueValuesAttributeTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/BooleanTrueValuesAttributeTests.cs
new file mode 100644
index 0000000..4149e9d
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/BooleanTrueValuesAttributeTests.cs
@@ -0,0 +1,110 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using CsvHelper.Configuration;
+using CsvHelper.Configuration.Attributes;
+using CsvHelper.Tests.Mocks;
+using Xunit;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CsvHelper.Tests.Mappings.ConstructorParameter
+{
+
+ public class BooleanTrueValuesAttributeTests
+ {
+ [Fact]
+ public void AutoMap_WithBooleanTrueValuesAttribute_CreatesParameterMaps()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture);
+ var context = new CsvContext(config);
+ var map = context.AutoMap<Foo>();
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.Empty(map.ParameterMaps[0].Data.TypeConverterOptions.BooleanTrueValues);
+ Assert.Empty(map.ParameterMaps[0].Data.TypeConverterOptions.BooleanFalseValues);
+ Assert.Single(map.ParameterMaps[1].Data.TypeConverterOptions.BooleanTrueValues);
+ Assert.Empty(map.ParameterMaps[1].Data.TypeConverterOptions.BooleanFalseValues);
+ Assert.Equal("Bar", map.ParameterMaps[1].Data.TypeConverterOptions.BooleanTrueValues[0]);
+ }
+
+ [Fact]
+ public void GetRecords_WithBooleanTrueValuesAttribute_HasHeader_CreatesRecords()
+ {
+ var parser = new ParserMock
+ {
+ { "id", "boolean" },
+ { "1", "Bar" },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.True(records[0].Boolean);
+ }
+ }
+
+ [Fact]
+ public void GetRecords_WithBooleanTrueValuesAttribute_NoHeader_CreatesRecords()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture)
+ {
+ HasHeaderRecord = false,
+ };
+ var parser = new ParserMock(config)
+ {
+ { "1", "Bar" },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.True(records[0].Boolean);
+ }
+ }
+
+ [Fact]
+ public void WriteRecords_WithBooleanTrueValuesAttribute_DoesntUseParameterMaps()
+ {
+ var records = new List<Foo>
+ {
+ new Foo(1, true),
+ };
+
+ using (var writer = new StringWriter())
+ using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+ {
+ csv.WriteRecords(records);
+
+ var expected = new StringBuilder();
+ expected.Append("Id,Boolean\r\n");
+ expected.Append("1,True\r\n");
+
+ Assert.Equal(expected.ToString(), writer.ToString());
+ }
+ }
+
+ private class Foo
+ {
+ public int Id { get; private set; }
+
+ public bool Boolean { get; private set; }
+
+ public Foo(int id, [BooleanTrueValues("Bar")]bool boolean)
+ {
+ Id = id;
+ Boolean = boolean;
+ }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/BooleanTrueValuesMapTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/BooleanTrueValuesMapTests.cs
new file mode 100644
index 0000000..318b439
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/BooleanTrueValuesMapTests.cs
@@ -0,0 +1,125 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using CsvHelper.Configuration;
+using CsvHelper.Configuration.Attributes;
+using CsvHelper.Tests.Mocks;
+using Xunit;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CsvHelper.Tests.Mappings.ConstructorParameter
+{
+
+ public class BooleanTrueValuesMapTests
+ {
+ [Fact]
+ public void AutoMap_WithBooleanFalseValuesAttribute_CreatesParameterMaps()
+ {
+ var map = new DefaultClassMap<Foo>();
+ map.Parameter("id");
+ map.Parameter("boolean").TypeConverterOption.BooleanValues(true, true, "Bar");
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.Empty(map.ParameterMaps[0].Data.TypeConverterOptions.BooleanTrueValues);
+ Assert.Empty(map.ParameterMaps[0].Data.TypeConverterOptions.BooleanFalseValues);
+ Assert.Single(map.ParameterMaps[1].Data.TypeConverterOptions.BooleanTrueValues);
+ Assert.Empty(map.ParameterMaps[1].Data.TypeConverterOptions.BooleanFalseValues);
+ Assert.Equal("Bar", map.ParameterMaps[1].Data.TypeConverterOptions.BooleanTrueValues[0]);
+ }
+
+ [Fact]
+ public void GetRecords_WithBooleanFalseValuesAttribute_HasHeader_CreatesRecords()
+ {
+ var parser = new ParserMock
+ {
+ { "id", "boolean" },
+ { "1", "Bar" },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ csv.Context.RegisterClassMap<FooMap>();
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.True(records[0].Boolean);
+ }
+ }
+
+ [Fact]
+ public void GetRecords_WithBooleanFalseValuesAttribute_NoHeader_CreatesRecords()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture)
+ {
+ HasHeaderRecord = false,
+ };
+ var parser = new ParserMock(config)
+ {
+ { "1", "Bar" },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ csv.Context.RegisterClassMap<FooMap>();
+
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.True(records[0].Boolean);
+ }
+ }
+
+ [Fact]
+ public void WriteRecords_WithBooleanFalseValuesAttribute_DoesntUseParameterMaps()
+ {
+ var records = new List<Foo>
+ {
+ new Foo(1, true),
+ };
+
+ using (var writer = new StringWriter())
+ using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+ {
+ csv.Context.RegisterClassMap<FooMap>();
+ csv.WriteRecords(records);
+
+ var expected = new StringBuilder();
+ expected.Append("Id,Boolean\r\n");
+ expected.Append("1,True\r\n");
+
+ Assert.Equal(expected.ToString(), writer.ToString());
+ }
+ }
+
+ private class Foo
+ {
+ public int Id { get; private set; }
+
+ public bool Boolean { get; private set; }
+
+ public Foo(int id, bool boolean)
+ {
+ Id = id;
+ Boolean = boolean;
+ }
+ }
+
+ private class FooMap : ClassMap<Foo>
+ {
+ public FooMap()
+ {
+ Map(m => m.Id);
+ Map(m => m.Boolean);
+ Parameter("id");
+ Parameter("boolean").TypeConverterOption.BooleanValues(true, true, "Bar");
+ }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/ConstantAttributeTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/ConstantAttributeTests.cs
new file mode 100644
index 0000000..bf42bdc
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/ConstantAttributeTests.cs
@@ -0,0 +1,109 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using CsvHelper.Configuration;
+using CsvHelper.Configuration.Attributes;
+using CsvHelper.Tests.Mocks;
+using Xunit;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CsvHelper.Tests.Mappings.ConstructorParameter
+{
+
+ public class ConstantAttributeTests
+ {
+ [Fact]
+ public void AutoMap_WithConstantAttributes_ConfiguresParameterMaps()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture);
+ var context = new CsvContext(config);
+ var map = context.AutoMap<Foo>();
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.False(map.ParameterMaps[0].Data.IsConstantSet);
+ Assert.Null(map.ParameterMaps[0].Data.Constant);
+ Assert.True(map.ParameterMaps[1].Data.IsConstantSet);
+ Assert.Equal("Bar", map.ParameterMaps[1].Data.Constant);
+ }
+
+ [Fact]
+ public void GetRecords_WithConstantAttributes_HasHeader_CreatesRecords()
+ {
+ var parser = new ParserMock
+ {
+ { "id", "name" },
+ { "1", "one" },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal("Bar", records[0].Name);
+ }
+ }
+
+ [Fact]
+ public void GetRecords_WithConstantAttributes_NoHeader_CreatesRecords()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture)
+ {
+ HasHeaderRecord = false,
+ };
+ var parser = new ParserMock(config)
+ {
+ { "1", "one" },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal("Bar", records[0].Name);
+ }
+ }
+
+ [Fact]
+ public void WriteRecords_WithConstantAttributes_DoesntUseParameterMaps()
+ {
+ var records = new List<Foo>
+ {
+ new Foo(1, null),
+ };
+
+ using (var writer = new StringWriter())
+ using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+ {
+ csv.WriteRecords(records);
+
+ var expected = new StringBuilder();
+ expected.Append("Id,Name\r\n");
+ expected.Append("1,\r\n");
+
+ Assert.Equal(expected.ToString(), writer.ToString());
+ }
+ }
+
+ private class Foo
+ {
+ public int Id { get; private set; }
+
+ public string Name { get; private set; }
+
+ public Foo(int id, [Constant("Bar")] string name)
+ {
+ Id = id;
+ Name = name;
+ }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/ConstantMapTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/ConstantMapTests.cs
new file mode 100644
index 0000000..523f383
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/ConstantMapTests.cs
@@ -0,0 +1,193 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using CsvHelper.Configuration;
+using CsvHelper.Tests.Mocks;
+using Xunit;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CsvHelper.Tests.Mappings.ConstructorParameter
+{
+
+ public class ConstantMapTests
+ {
+ [Fact]
+ public void Parameter_WithName_CreatesParameterMaps()
+ {
+ var map = new DefaultClassMap<Foo>();
+ map.Parameter("id");
+ map.Parameter("name").Constant("Bar");
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.False(map.ParameterMaps[0].Data.IsConstantSet);
+ Assert.True(map.ParameterMaps[1].Data.IsConstantSet);
+ Assert.Equal("Bar", map.ParameterMaps[1].Data.Constant);
+ }
+
+ [Fact]
+ public void Parameter_WithConstructorFunctionAndName_CreatesParameterMaps()
+ {
+ var map = new DefaultClassMap<Foo>();
+ map.Parameter(() => ConfigurationFunctions.GetConstructor(new GetConstructorArgs(typeof(Foo))), "id");
+ map.Parameter(() => ConfigurationFunctions.GetConstructor(new GetConstructorArgs(typeof(Foo))), "name").Constant("Bar");
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.False(map.ParameterMaps[0].Data.IsConstantSet);
+ Assert.True(map.ParameterMaps[1].Data.IsConstantSet);
+ Assert.Equal("Bar", map.ParameterMaps[1].Data.Constant);
+ }
+
+ [Fact]
+ public void Parameter_WithConstructorAndProperty_CreatesParameterMaps()
+ {
+ var constructor = ConfigurationFunctions.GetConstructor(new GetConstructorArgs(typeof(Foo)));
+ var parameters = constructor.GetParameters();
+
+ var map = new DefaultClassMap<Foo>();
+ map.Parameter(constructor, parameters[0]);
+ map.Parameter(constructor, parameters[1]).Constant("Bar");
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.False(map.ParameterMaps[0].Data.IsConstantSet);
+ Assert.True(map.ParameterMaps[1].Data.IsConstantSet);
+ Assert.Equal("Bar", map.ParameterMaps[1].Data.Constant);
+ }
+
+ [Fact]
+ public void GetRecords_WithParameterMap_HasHeader_CreatesRecords()
+ {
+ var parser = new ParserMock
+ {
+ { "id", "name" },
+ { "1", "one" },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ var map = csv.Context.RegisterClassMap<FooMap>();
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal("Bar", records[0].Name);
+ }
+ }
+
+ [Fact]
+ public void GetRecords_WithParameterMap_NoHeader_CreatesRecords()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture)
+ {
+ HasHeaderRecord = false,
+ };
+ var parser = new ParserMock(config)
+ {
+ { "1" },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ csv.Context.RegisterClassMap<FooMap>();
+
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal("Bar", records[0].Name);
+ }
+ }
+
+ [Fact]
+ public void GetRecords_WithParameterMap_HasHeader_FieldMissing_CreatesRecords()
+ {
+ var parser = new ParserMock
+ {
+ { "id" },
+ { "1" },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ var map = csv.Context.RegisterClassMap<FooMap>();
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal("Bar", records[0].Name);
+ }
+ }
+
+ [Fact]
+ public void GetRecords_WithParameterMap_NoHeader_FieldMissing_CreatesRecords()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture)
+ {
+ HasHeaderRecord = false,
+ };
+ var parser = new ParserMock(config)
+ {
+ { "1" },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ var map = csv.Context.RegisterClassMap<FooMap>();
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal("Bar", records[0].Name);
+ }
+ }
+
+ [Fact]
+ public void WriteRecords_WithParameterMap_DoesntUseParameterMaps()
+ {
+ var records = new List<Foo>
+ {
+ new Foo(1, "one"),
+ };
+
+ using (var writer = new StringWriter())
+ using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+ {
+ csv.Context.RegisterClassMap<FooMap>();
+
+ csv.WriteRecords(records);
+
+ var expected = new StringBuilder();
+ expected.Append("Id,Name\r\n");
+ expected.Append("1,one\r\n");
+
+ Assert.Equal(expected.ToString(), writer.ToString());
+ }
+ }
+
+ private class Foo
+ {
+ public int Id { get; private set; }
+
+ public string Name { get; private set; }
+
+ public Foo(int id, string name)
+ {
+ Id = id;
+ Name = name;
+ }
+ }
+
+ private class FooMap : ClassMap<Foo>
+ {
+ public FooMap()
+ {
+ Map(m => m.Id);
+ Map(m => m.Name);
+ Parameter("id");
+ Parameter("name").Constant("Bar");
+ }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/CultureInfoAttributeTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/CultureInfoAttributeTests.cs
new file mode 100644
index 0000000..a76883d
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/CultureInfoAttributeTests.cs
@@ -0,0 +1,119 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using CsvHelper.Configuration;
+using CsvHelper.Configuration.Attributes;
+using CsvHelper.Tests.Mocks;
+using Xunit;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Threading;
+
+namespace CsvHelper.Tests.Mappings.ConstructorParameter
+{
+
+ public class CultureInfoAttributeTests
+ {
+ private const decimal AMOUNT = 123_456.789M;
+ private const string CULTURE = "fr-FR";
+ private readonly string amount = AMOUNT.ToString(new CultureInfo(CULTURE));
+
+ [Fact]
+ public void AutoMap_WithCultureInfoAttributes_ConfiguresParameterMaps()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture);
+ var context = new CsvContext(config);
+ var map = context.AutoMap<Foo>();
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.Null(map.ParameterMaps[0].Data.TypeConverterOptions.CultureInfo);
+ Assert.Equal(new CultureInfo(CULTURE), map.ParameterMaps[1].Data.TypeConverterOptions.CultureInfo);
+ }
+
+ [Fact]
+ public void GetRecords_WithCultureInfoAttributes_HasHeader_CreatesRecords()
+ {
+ var parser = new ParserMock
+ {
+ { "id", "amount" },
+ { "1", amount },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal(AMOUNT, records[0].Amount);
+ }
+ }
+
+ [Fact]
+ public void GetRecords_WithCultureInfoAttributes_NoHeader_CreatesRecords()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture)
+ {
+ HasHeaderRecord = false,
+ };
+ var parser = new ParserMock(config)
+ {
+ { "1", amount },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal(AMOUNT, records[0].Amount);
+ }
+ }
+
+ [Fact]
+ public void WriteRecords_WithCultureInfoAttributes_DoesntUseParameterMaps()
+ {
+ var records = new List<Foo>
+ {
+ new Foo(1, AMOUNT),
+ };
+
+ var prevCulture = Thread.CurrentThread.CurrentCulture;
+ try {
+ Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
+ using (var writer = new StringWriter())
+ using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+ {
+ csv.WriteRecords(records);
+
+ var expected = new StringBuilder();
+ expected.Append("Id,Amount\r\n");
+ expected.Append($"1,{AMOUNT}\r\n");
+
+ Assert.Equal(expected.ToString(), writer.ToString());
+ }
+ } finally {
+ Thread.CurrentThread.CurrentCulture = prevCulture;
+ }
+ }
+
+ private class Foo
+ {
+ public int Id { get; private set; }
+
+ public decimal Amount { get; private set; }
+
+ public Foo(int id, [CultureInfo(CULTURE)] decimal amount)
+ {
+ Id = id;
+ Amount = amount;
+ }
+ }
+
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/CultureInfoMapTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/CultureInfoMapTests.cs
new file mode 100644
index 0000000..71ae189
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/CultureInfoMapTests.cs
@@ -0,0 +1,160 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using CsvHelper.Configuration;
+using CsvHelper.Tests.Mocks;
+using Xunit;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Threading;
+
+namespace CsvHelper.Tests.Mappings.ConstructorParameter
+{
+
+ public class CultureInfoMapTests
+ {
+ private const decimal AMOUNT = 123_456.789M;
+ private const string CULTURE = "fr-FR";
+ private readonly string amount = AMOUNT.ToString(new CultureInfo(CULTURE));
+
+ [Fact]
+ public void Parameter_WithName_CreatesParameterMaps()
+ {
+ var map = new DefaultClassMap<Foo>();
+ map.Parameter("id");
+ map.Parameter("amount").TypeConverterOption.CultureInfo(new CultureInfo(CULTURE));
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.Null(map.ParameterMaps[0].Data.TypeConverterOptions.CultureInfo);
+ Assert.Equal(new CultureInfo(CULTURE), map.ParameterMaps[1].Data.TypeConverterOptions.CultureInfo);
+ }
+
+ [Fact]
+ public void Parameter_WithConstructorFunctionAndName_CreatesParameterMaps()
+ {
+ var map = new DefaultClassMap<Foo>();
+ map.Parameter(() => ConfigurationFunctions.GetConstructor(new GetConstructorArgs(typeof(Foo))), "id");
+ map.Parameter(() => ConfigurationFunctions.GetConstructor(new GetConstructorArgs(typeof(Foo))), "amount").TypeConverterOption.CultureInfo(new CultureInfo(CULTURE));
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.Null(map.ParameterMaps[0].Data.TypeConverterOptions.CultureInfo);
+ Assert.Equal(new CultureInfo(CULTURE), map.ParameterMaps[1].Data.TypeConverterOptions.CultureInfo);
+ }
+
+ [Fact]
+ public void Parameter_WithConstructorAndProperty_CreatesParameterMaps()
+ {
+ var constructor = ConfigurationFunctions.GetConstructor(new GetConstructorArgs(typeof(Foo)));
+ var parameters = constructor.GetParameters();
+
+ var map = new DefaultClassMap<Foo>();
+ map.Parameter(constructor, parameters[0]);
+ map.Parameter(constructor, parameters[1]).TypeConverterOption.CultureInfo(new CultureInfo(CULTURE));
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.Null(map.ParameterMaps[0].Data.TypeConverterOptions.CultureInfo);
+ Assert.Equal(new CultureInfo(CULTURE), map.ParameterMaps[1].Data.TypeConverterOptions.CultureInfo);
+ }
+
+ [Fact]
+ public void GetRecords_WithParameterMap_HasHeader_CreatesRecords()
+ {
+ var parser = new ParserMock
+ {
+ { "id", "amount" },
+ { "1", amount },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ var map = csv.Context.RegisterClassMap<FooMap>();
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal(AMOUNT, records[0].Amount);
+ }
+ }
+
+ [Fact]
+ public void GetRecords_WithParameterMap_NoHeader_CreatesRecords()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture)
+ {
+ HasHeaderRecord = false,
+ };
+ var parser = new ParserMock(config)
+ {
+ { "1", amount },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ csv.Context.RegisterClassMap<FooMap>();
+
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal(AMOUNT, records[0].Amount);
+ }
+ }
+
+ [Fact]
+ public void WriteRecords_WithParameterMap_DoesntUseParameterMaps()
+ {
+ var records = new List<Foo>
+ {
+ new Foo(1, AMOUNT),
+ };
+
+ var prevCulture = Thread.CurrentThread.CurrentCulture;
+ try {
+ Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
+ using (var writer = new StringWriter())
+ using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+ {
+ csv.Context.RegisterClassMap<FooMap>();
+
+ csv.WriteRecords(records);
+
+ var expected = new StringBuilder();
+ expected.Append("Id,Amount\r\n");
+ expected.Append($"1,{AMOUNT}\r\n");
+
+ Assert.Equal(expected.ToString(), writer.ToString());
+ }
+ } finally {
+ Thread.CurrentThread.CurrentCulture = prevCulture;
+ }
+ }
+
+ private class Foo
+ {
+ public int Id { get; private set; }
+
+ public decimal Amount { get; private set; }
+
+ public Foo(int id, decimal amount)
+ {
+ Id = id;
+ Amount = amount;
+ }
+ }
+
+ private class FooMap : ClassMap<Foo>
+ {
+ public FooMap()
+ {
+ Map(m => m.Id);
+ Map(m => m.Amount);
+ Parameter("id");
+ Parameter("amount").TypeConverterOption.CultureInfo(new CultureInfo(CULTURE));
+ }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/DateTimeStylesAttributeTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/DateTimeStylesAttributeTests.cs
new file mode 100644
index 0000000..7207853
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/DateTimeStylesAttributeTests.cs
@@ -0,0 +1,109 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using CsvHelper.Configuration;
+using CsvHelper.Configuration.Attributes;
+using CsvHelper.Tests.Mocks;
+using Xunit;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CsvHelper.Tests.Mappings.ConstructorParameter
+{
+
+ public class DateTimeStylesAttributeTests
+ {
+ private const string DATE = "12/25/2020";
+ private readonly DateTimeOffset date = DateTimeOffset.Parse(DATE, CultureInfo.InvariantCulture);
+
+ [Fact]
+ public void AutoMap_WithCultureInfoAttributes_ConfiguresParameterMaps()
+ {
+ var context = new CsvContext(new CsvConfiguration(CultureInfo.InvariantCulture));
+ var map = context.AutoMap<Foo>();
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.Null(map.ParameterMaps[0].Data.TypeConverterOptions.DateTimeStyle);
+ Assert.Equal(DateTimeStyles.AllowLeadingWhite, map.ParameterMaps[1].Data.TypeConverterOptions.DateTimeStyle);
+ }
+
+ [Fact]
+ public void GetRecords_WithCultureInfoAttributes_HasHeader_CreatesRecords()
+ {
+ var parser = new ParserMock
+ {
+ { "id", "date" },
+ { "1", $" {DATE}" },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal(date, records[0].Date);
+ }
+ }
+
+ [Fact]
+ public void GetRecords_WithCultureInfoAttributes_NoHeader_CreatesRecords()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture)
+ {
+ HasHeaderRecord = false,
+ };
+ var parser = new ParserMock(config)
+ {
+ { "1", $" {DATE}" },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal(date, records[0].Date);
+ }
+ }
+
+ [Fact]
+ public void WriteRecords_WithCultureInfoAttributes_DoesntUseParameterMaps()
+ {
+ var records = new List<Foo>
+ {
+ new Foo(1, date),
+ };
+
+ using (var writer = new StringWriter())
+ using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+ {
+ csv.WriteRecords(records);
+
+ var expected = new StringBuilder();
+ expected.Append("Id,Date\r\n");
+ expected.Append($"1,{date.ToString(null, CultureInfo.InvariantCulture)}\r\n");
+
+ Assert.Equal(expected.ToString(), writer.ToString());
+ }
+ }
+
+ private class Foo
+ {
+ public int Id { get; private set; }
+
+ public DateTimeOffset Date { get; private set; }
+
+ public Foo(int id, [DateTimeStyles(DateTimeStyles.AllowLeadingWhite)] DateTimeOffset date)
+ {
+ Id = id;
+ Date = date;
+ }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/DateTimeStylesMapTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/DateTimeStylesMapTests.cs
new file mode 100644
index 0000000..d94b75f
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/DateTimeStylesMapTests.cs
@@ -0,0 +1,152 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using CsvHelper.Configuration;
+using CsvHelper.Tests.Mocks;
+using Xunit;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CsvHelper.Tests.Mappings.ConstructorParameter
+{
+
+ public class DateTimeStylesMapTests
+ {
+ private const string DATE = "12/25/2020";
+ private readonly DateTimeOffset date = DateTimeOffset.Parse(DATE, CultureInfo.InvariantCulture);
+
+ [Fact]
+ public void Parameter_WithName_CreatesParameterMaps()
+ {
+ var map = new DefaultClassMap<Foo>();
+ map.Parameter("id");
+ map.Parameter("date").TypeConverterOption.DateTimeStyles(DateTimeStyles.AllowLeadingWhite);
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.Null(map.ParameterMaps[0].Data.TypeConverterOptions.DateTimeStyle);
+ Assert.Equal(DateTimeStyles.AllowLeadingWhite, map.ParameterMaps[1].Data.TypeConverterOptions.DateTimeStyle);
+ }
+
+ [Fact]
+ public void Parameter_WithConstructorFunctionAndName_CreatesParameterMaps()
+ {
+ var map = new DefaultClassMap<Foo>();
+ map.Parameter(() => ConfigurationFunctions.GetConstructor(new GetConstructorArgs(typeof(Foo))), "id");
+ map.Parameter(() => ConfigurationFunctions.GetConstructor(new GetConstructorArgs(typeof(Foo))), "date").TypeConverterOption.DateTimeStyles(DateTimeStyles.AllowLeadingWhite);
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.Null(map.ParameterMaps[0].Data.TypeConverterOptions.DateTimeStyle);
+ Assert.Equal(DateTimeStyles.AllowLeadingWhite, map.ParameterMaps[1].Data.TypeConverterOptions.DateTimeStyle);
+ }
+
+ [Fact]
+ public void Parameter_WithConstructorAndProperty_CreatesParameterMaps()
+ {
+ var constructor = ConfigurationFunctions.GetConstructor(new GetConstructorArgs(typeof(Foo)));
+ var parameters = constructor.GetParameters();
+
+ var map = new DefaultClassMap<Foo>();
+ map.Parameter(constructor, parameters[0]);
+ map.Parameter(constructor, parameters[1]).TypeConverterOption.DateTimeStyles(DateTimeStyles.AllowLeadingWhite);
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.Null(map.ParameterMaps[0].Data.TypeConverterOptions.DateTimeStyle);
+ Assert.Equal(DateTimeStyles.AllowLeadingWhite, map.ParameterMaps[1].Data.TypeConverterOptions.DateTimeStyle);
+ }
+
+ [Fact]
+ public void GetRecords_WithParameterMap_HasHeader_CreatesRecords()
+ {
+ var parser = new ParserMock
+ {
+ { "id", "date" },
+ { "1", DATE },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ var map = csv.Context.RegisterClassMap<FooMap>();
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal(date, records[0].Date);
+ }
+ }
+
+ [Fact]
+ public void GetRecords_WithParameterMap_NoHeader_CreatesRecords()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture)
+ {
+ HasHeaderRecord = false,
+ };
+ var parser = new ParserMock(config)
+ {
+ { "1", DATE },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ csv.Context.RegisterClassMap<FooMap>();
+
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal(date, records[0].Date);
+ }
+ }
+
+ [Fact]
+ public void WriteRecords_WithParameterMap_DoesntUseParameterMaps()
+ {
+ var records = new List<Foo>
+ {
+ new Foo(1, date),
+ };
+
+ using (var writer = new StringWriter())
+ using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+ {
+ csv.Context.RegisterClassMap<FooMap>();
+
+ csv.WriteRecords(records);
+
+ var expected = new StringBuilder();
+ expected.Append("Id,Date\r\n");
+ expected.Append($"1,{date.ToString(null, CultureInfo.InvariantCulture)}\r\n");
+
+ Assert.Equal(expected.ToString(), writer.ToString());
+ }
+ }
+
+ private class Foo
+ {
+ public int Id { get; private set; }
+
+ public DateTimeOffset Date { get; private set; }
+
+ public Foo(int id, DateTimeOffset date)
+ {
+ Id = id;
+ Date = date;
+ }
+ }
+
+ private class FooMap : ClassMap<Foo>
+ {
+ public FooMap()
+ {
+ Map(m => m.Id);
+ Map(m => m.Date);
+ Parameter("id");
+ Parameter("date").TypeConverterOption.DateTimeStyles(DateTimeStyles.AllowLeadingWhite);
+ }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/DefaultAttributeTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/DefaultAttributeTests.cs
new file mode 100644
index 0000000..226878d
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/DefaultAttributeTests.cs
@@ -0,0 +1,108 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using CsvHelper.Configuration;
+using CsvHelper.Configuration.Attributes;
+using CsvHelper.Tests.Mocks;
+using Xunit;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CsvHelper.Tests.Mappings.ConstructorParameter
+{
+
+ public class DefaultAttributeTests
+ {
+ [Fact]
+ public void AutoMap_WithDefaultAttributes_ConfiguresParameterMaps()
+ {
+ var context = new CsvContext(new CsvConfiguration(CultureInfo.InvariantCulture));
+ var map = context.AutoMap<Foo>();
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.False(map.ParameterMaps[0].Data.IsDefaultSet);
+ Assert.Null(map.ParameterMaps[0].Data.Default);
+ Assert.True(map.ParameterMaps[1].Data.IsDefaultSet);
+ Assert.Equal("Bar", map.ParameterMaps[1].Data.Default);
+ }
+
+ [Fact]
+ public void GetRecords_WithDefaultAttributes_HasHeader_CreatesRecords()
+ {
+ var parser = new ParserMock
+ {
+ { "id", "name" },
+ { "1", "" },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal("Bar", records[0].Name);
+ }
+ }
+
+ [Fact]
+ public void GetRecords_WithDefaultAttributes_NoHeader_CreatesRecords()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture)
+ {
+ HasHeaderRecord = false,
+ };
+ var parser = new ParserMock(config)
+ {
+ { "1", "" },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal("Bar", records[0].Name);
+ }
+ }
+
+ [Fact]
+ public void WriteRecords_WithDefaultAttributes_DoesntUseParameterMaps()
+ {
+ var records = new List<Foo>
+ {
+ new Foo(1, null),
+ };
+
+ using (var writer = new StringWriter())
+ using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+ {
+ csv.WriteRecords(records);
+
+ var expected = new StringBuilder();
+ expected.Append("Id,Name\r\n");
+ expected.Append("1,\r\n");
+
+ Assert.Equal(expected.ToString(), writer.ToString());
+ }
+ }
+
+ private class Foo
+ {
+ public int Id { get; private set; }
+
+ public string Name { get; private set; }
+
+ public Foo(int id, [Default("Bar")] string name)
+ {
+ Id = id;
+ Name = name;
+ }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/DefaultMapTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/DefaultMapTests.cs
new file mode 100644
index 0000000..3b6f76d
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/DefaultMapTests.cs
@@ -0,0 +1,152 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using CsvHelper.Configuration;
+using CsvHelper.Tests.Mocks;
+using Xunit;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CsvHelper.Tests.Mappings.ConstructorParameter
+{
+
+ public class DefaultMapTests
+ {
+ [Fact]
+ public void Parameter_WithName_CreatesParameterMaps()
+ {
+ var map = new DefaultClassMap<Foo>();
+ map.Parameter("id");
+ map.Parameter("name").Default("Bar");
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.False(map.ParameterMaps[0].Data.IsDefaultSet);
+ Assert.True(map.ParameterMaps[1].Data.IsDefaultSet);
+ Assert.Equal("Bar", map.ParameterMaps[1].Data.Default);
+ }
+
+ [Fact]
+ public void Parameter_WithConstructorFunctionAndName_CreatesParameterMaps()
+ {
+ var map = new DefaultClassMap<Foo>();
+ map.Parameter(() => ConfigurationFunctions.GetConstructor(new GetConstructorArgs(typeof(Foo))), "id");
+ map.Parameter(() => ConfigurationFunctions.GetConstructor(new GetConstructorArgs(typeof(Foo))), "name").Default("Bar");
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.False(map.ParameterMaps[0].Data.IsDefaultSet);
+ Assert.True(map.ParameterMaps[1].Data.IsDefaultSet);
+ Assert.Equal("Bar", map.ParameterMaps[1].Data.Default);
+ }
+
+ [Fact]
+ public void Parameter_WithConstructorAndProperty_CreatesParameterMaps()
+ {
+ var constructor = ConfigurationFunctions.GetConstructor(new GetConstructorArgs(typeof(Foo)));
+ var parameters = constructor.GetParameters();
+
+ var map = new DefaultClassMap<Foo>();
+ map.Parameter(constructor, parameters[0]);
+ map.Parameter(constructor, parameters[1]).Default("Bar");
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.False(map.ParameterMaps[0].Data.IsDefaultSet);
+ Assert.True(map.ParameterMaps[1].Data.IsDefaultSet);
+ Assert.Equal("Bar", map.ParameterMaps[1].Data.Default);
+ }
+
+ [Fact]
+ public void GetRecords_WithParameterMap_HasHeader_CreatesRecords()
+ {
+ var parser = new ParserMock
+ {
+ { "id", "name" },
+ { "1", "" },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ var map = csv.Context.RegisterClassMap<FooMap>();
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal("Bar", records[0].Name);
+ }
+ }
+
+ [Fact]
+ public void GetRecords_WithParameterMap_NoHeader_CreatesRecords()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture)
+ {
+ HasHeaderRecord = false,
+ };
+ var parser = new ParserMock(config)
+ {
+ { "1", "" },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ csv.Context.RegisterClassMap<FooMap>();
+
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal("Bar", records[0].Name);
+ }
+ }
+
+ [Fact]
+ public void WriteRecords_WithParameterMap_DoesntUseParameterMaps()
+ {
+ var records = new List<Foo>
+ {
+ new Foo(1, "one"),
+ };
+
+ using (var writer = new StringWriter())
+ using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+ {
+ csv.Context.RegisterClassMap<FooMap>();
+
+ csv.WriteRecords(records);
+
+ var expected = new StringBuilder();
+ expected.Append("Id,Name\r\n");
+ expected.Append("1,one\r\n");
+
+ Assert.Equal(expected.ToString(), writer.ToString());
+ }
+ }
+
+ private class Foo
+ {
+ public int Id { get; private set; }
+
+ public string Name { get; private set; }
+
+ public Foo(int id, string name)
+ {
+ Id = id;
+ Name = name;
+ }
+ }
+
+ private class FooMap : ClassMap<Foo>
+ {
+ public FooMap()
+ {
+ Map(m => m.Id);
+ Map(m => m.Name);
+ Parameter("id");
+ Parameter("name").Default("Bar");
+ }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/EnumIgnoreCaseTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/EnumIgnoreCaseTests.cs
new file mode 100644
index 0000000..af23233
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/EnumIgnoreCaseTests.cs
@@ -0,0 +1,113 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using CsvHelper.Configuration;
+using CsvHelper.Configuration.Attributes;
+using CsvHelper.Tests.Mocks;
+using Xunit;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CsvHelper.Tests.Mappings.ConstructorParameter
+{
+
+ public class EnumIgnoreCaseTests
+ {
+ [Fact]
+ public void AutoMap_WithEnumIgnoreCaseAttributes_ConfiguresParameterMaps()
+ {
+ var context = new CsvContext(new CsvConfiguration(CultureInfo.InvariantCulture));
+ var map = context.AutoMap<Foo>();
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.Equal("id", map.ParameterMaps[0].Data.Names.First());
+ Assert.Equal("bar", map.ParameterMaps[1].Data.Names.First());
+ Assert.True(map.ParameterMaps[1].Data.TypeConverterOptions.EnumIgnoreCase.GetValueOrDefault());
+ }
+
+ [Fact]
+ public void GetRecords_WithEnumIgnoreCaseAttributes_HasHeader_CreatesRecords()
+ {
+ var parser = new ParserMock
+ {
+ { "id", "bar" },
+ { "1", "one" },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal(Bar.One, records[0].Bar);
+ }
+ }
+
+ [Fact]
+ public void GetRecords_WithEnumIgnoreCaseAttributes_NoHeader_CreatesRecords()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture)
+ {
+ HasHeaderRecord = false,
+ };
+ var parser = new ParserMock(config)
+ {
+ { "1", "one" },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal(Bar.One, records[0].Bar);
+ }
+ }
+
+ [Fact]
+ public void WriteRecords_WithIgnoreAttributes_DoesntUseParameterMaps()
+ {
+ var records = new List<Foo>
+ {
+ new Foo(1, Bar.None),
+ };
+
+ using (var writer = new StringWriter())
+ using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+ {
+ csv.WriteRecords(records);
+
+ var expected = new StringBuilder();
+ expected.Append("Id,Bar\r\n");
+ expected.Append("1,None\r\n");
+
+ Assert.Equal(expected.ToString(), writer.ToString());
+ }
+ }
+
+ private class Foo
+ {
+ public int Id { get; private set; }
+
+ public Bar Bar { get; private set; }
+
+ public Foo(int id, [EnumIgnoreCase] Bar bar)
+ {
+ Id = id;
+ Bar = bar;
+ }
+ }
+
+ private enum Bar
+ {
+ None = 0,
+ One = 1
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/FormatAttributeTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/FormatAttributeTests.cs
new file mode 100644
index 0000000..b3fa1ac
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/FormatAttributeTests.cs
@@ -0,0 +1,111 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using CsvHelper.Configuration;
+using CsvHelper.Configuration.Attributes;
+using CsvHelper.Tests.Mocks;
+using Xunit;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CsvHelper.Tests.Mappings.ConstructorParameter
+{
+
+ public class FormatAttributeTests
+ {
+ private const string FORMAT = "MM|dd|yyyy";
+ private const string DATE = "12|25|2020";
+ private readonly DateTimeOffset date = DateTimeOffset.ParseExact(DATE, FORMAT, CultureInfo.InvariantCulture, DateTimeStyles.None);
+
+ [Fact]
+ public void AutoMap_WithCultureInfoAttributes_ConfiguresParameterMaps()
+ {
+ var context = new CsvContext(new CsvConfiguration(CultureInfo.InvariantCulture));
+ var map = context.AutoMap<Foo>();
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.Null(map.ParameterMaps[0].Data.TypeConverterOptions.Formats);
+ Assert.Single(map.ParameterMaps[1].Data.TypeConverterOptions.Formats);
+ Assert.Equal(FORMAT, map.ParameterMaps[1].Data.TypeConverterOptions.Formats[0]);
+ }
+
+ [Fact]
+ public void GetRecords_WithCultureInfoAttributes_HasHeader_CreatesRecords()
+ {
+ var parser = new ParserMock
+ {
+ { "id", "date" },
+ { "1", DATE },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal(date, records[0].Date);
+ }
+ }
+
+ [Fact]
+ public void GetRecords_WithCultureInfoAttributes_NoHeader_CreatesRecords()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture)
+ {
+ HasHeaderRecord = false,
+ };
+ var parser = new ParserMock(config)
+ {
+ { "1", DATE },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal(date, records[0].Date);
+ }
+ }
+
+ [Fact]
+ public void WriteRecords_WithCultureInfoAttributes_DoesntUseParameterMaps()
+ {
+ var records = new List<Foo>
+ {
+ new Foo(1, date),
+ };
+
+ using (var writer = new StringWriter())
+ using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+ {
+ csv.WriteRecords(records);
+
+ var expected = new StringBuilder();
+ expected.Append("Id,Date\r\n");
+ expected.Append($"1,{date.ToString(null, CultureInfo.InvariantCulture)}\r\n");
+
+ Assert.Equal(expected.ToString(), writer.ToString());
+ }
+ }
+
+ private class Foo
+ {
+ public int Id { get; private set; }
+
+ public DateTimeOffset Date { get; private set; }
+
+ public Foo(int id, [Format(FORMAT)] DateTimeOffset date)
+ {
+ Id = id;
+ Date = date;
+ }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/FormatMapTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/FormatMapTests.cs
new file mode 100644
index 0000000..673a1f7
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/FormatMapTests.cs
@@ -0,0 +1,156 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using CsvHelper.Configuration;
+using CsvHelper.Tests.Mocks;
+using Xunit;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CsvHelper.Tests.Mappings.ConstructorParameter
+{
+
+ public class FormatMapTests
+ {
+ private const string FORMAT = "MM|dd|yyyy";
+ private const string DATE = "12|25|2020";
+ private readonly DateTimeOffset date = DateTimeOffset.ParseExact(DATE, FORMAT, CultureInfo.InvariantCulture, DateTimeStyles.None);
+
+ [Fact]
+ public void Parameter_WithName_CreatesParameterMaps()
+ {
+ var map = new DefaultClassMap<Foo>();
+ map.Parameter("id");
+ map.Parameter("date").TypeConverterOption.Format(FORMAT);
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.Null(map.ParameterMaps[0].Data.TypeConverterOptions.Formats);
+ Assert.Single(map.ParameterMaps[1].Data.TypeConverterOptions.Formats);
+ Assert.Equal(FORMAT, map.ParameterMaps[1].Data.TypeConverterOptions.Formats[0]);
+ }
+
+ [Fact]
+ public void Parameter_WithConstructorFunctionAndName_CreatesParameterMaps()
+ {
+ var map = new DefaultClassMap<Foo>();
+ map.Parameter(() => ConfigurationFunctions.GetConstructor(new GetConstructorArgs(typeof(Foo))), "id");
+ map.Parameter(() => ConfigurationFunctions.GetConstructor(new GetConstructorArgs(typeof(Foo))), "date").TypeConverterOption.Format(FORMAT);
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.Null(map.ParameterMaps[0].Data.TypeConverterOptions.Formats);
+ Assert.Single(map.ParameterMaps[1].Data.TypeConverterOptions.Formats);
+ Assert.Equal(FORMAT, map.ParameterMaps[1].Data.TypeConverterOptions.Formats[0]);
+ }
+
+ [Fact]
+ public void Parameter_WithConstructorAndProperty_CreatesParameterMaps()
+ {
+ var constructor = ConfigurationFunctions.GetConstructor(new GetConstructorArgs(typeof(Foo)));
+ var parameters = constructor.GetParameters();
+
+ var map = new DefaultClassMap<Foo>();
+ map.Parameter(constructor, parameters[0]);
+ map.Parameter(constructor, parameters[1]).TypeConverterOption.Format(FORMAT);
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.Null(map.ParameterMaps[0].Data.TypeConverterOptions.Formats);
+ Assert.Single(map.ParameterMaps[1].Data.TypeConverterOptions.Formats);
+ Assert.Equal(FORMAT, map.ParameterMaps[1].Data.TypeConverterOptions.Formats[0]);
+ }
+
+ [Fact]
+ public void GetRecords_WithParameterMap_HasHeader_CreatesRecords()
+ {
+ var parser = new ParserMock
+ {
+ { "id", "date" },
+ { "1", DATE },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ var map = csv.Context.RegisterClassMap<FooMap>();
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal(date, records[0].Date);
+ }
+ }
+
+ [Fact]
+ public void GetRecords_WithParameterMap_NoHeader_CreatesRecords()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture)
+ {
+ HasHeaderRecord = false,
+ };
+ var parser = new ParserMock(config)
+ {
+ { "1", DATE },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ csv.Context.RegisterClassMap<FooMap>();
+
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal(date, records[0].Date);
+ }
+ }
+
+ [Fact]
+ public void WriteRecords_WithParameterMap_DoesntUseParameterMaps()
+ {
+ var records = new List<Foo>
+ {
+ new Foo(1, date),
+ };
+
+ using (var writer = new StringWriter())
+ using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+ {
+ csv.Context.RegisterClassMap<FooMap>();
+
+ csv.WriteRecords(records);
+
+ var expected = new StringBuilder();
+ expected.Append("Id,Date\r\n");
+ expected.Append($"1,{date.ToString(null, CultureInfo.InvariantCulture)}\r\n");
+
+ Assert.Equal(expected.ToString(), writer.ToString());
+ }
+ }
+
+ private class Foo
+ {
+ public int Id { get; private set; }
+
+ public DateTimeOffset Date { get; private set; }
+
+ public Foo(int id, DateTimeOffset date)
+ {
+ Id = id;
+ Date = date;
+ }
+ }
+
+ private class FooMap : ClassMap<Foo>
+ {
+ public FooMap()
+ {
+ Map(m => m.Id);
+ Map(m => m.Date);
+ Parameter("id");
+ Parameter("date").TypeConverterOption.Format(FORMAT);
+ }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/HeaderPrefixAttributeTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/HeaderPrefixAttributeTests.cs
new file mode 100644
index 0000000..051f9f5
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/HeaderPrefixAttributeTests.cs
@@ -0,0 +1,111 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using CsvHelper.Configuration;
+using CsvHelper.Configuration.Attributes;
+using CsvHelper.Tests.Mocks;
+using Xunit;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CsvHelper.Tests.Mappings.ConstructorParameter
+{
+
+ public class HeaderPrefixAttributeTests
+ {
+ [Fact]
+ public void AutoMap_WithCultureInfoAttributes_ConfiguresParameterMaps()
+ {
+ var context = new CsvContext(new CsvConfiguration(CultureInfo.InvariantCulture));
+ var map = context.AutoMap<Foo>();
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.Null(map.ParameterMaps[0].ReferenceMap);
+ Assert.Equal("Bar_", map.ParameterMaps[1].ReferenceMap.Data.Prefix);
+ }
+
+ [Fact]
+ public void GetRecords_WithCultureInfoAttributes_HasHeader_CreatesRecords()
+ {
+ var parser = new ParserMock
+ {
+ { "id", "Bar_Name" },
+ { "1", "one" },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal("one", records[0].Bar.Name);
+ }
+ }
+
+ [Fact]
+ public void GetRecords_WithCultureInfoAttributes_NoHeader_CreatesRecords()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture)
+ {
+ HasHeaderRecord = false,
+ };
+ var parser = new ParserMock(config)
+ {
+ { "1", "one" },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal("one", records[0].Bar.Name);
+ }
+ }
+
+ [Fact]
+ public void WriteRecords_WithCultureInfoAttributes_DoesntUseParameterMaps()
+ {
+ var records = new List<Foo>
+ {
+ new Foo(1, new Bar { Name = "one" }),
+ };
+
+ using (var writer = new StringWriter())
+ using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+ {
+ csv.WriteRecords(records);
+
+ var expected = new StringBuilder();
+ expected.Append("Id,Name\r\n");
+ expected.Append("1,one\r\n");
+
+ Assert.Equal(expected.ToString(), writer.ToString());
+ }
+ }
+
+ private class Foo
+ {
+ public int Id { get; private set; }
+
+ public Bar Bar { get; private set; }
+
+ public Foo(int id, [HeaderPrefix("Bar_")]Bar bar)
+ {
+ Id = id;
+ Bar = bar;
+ }
+ }
+
+ private class Bar
+ {
+ public string Name { get; set; }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/HeaderPrefixMapTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/HeaderPrefixMapTests.cs
new file mode 100644
index 0000000..4c5e0be
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/HeaderPrefixMapTests.cs
@@ -0,0 +1,6 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+
+// It doesn't make sense to map a prefix as you would just set the header name you want including the prefix.
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/IgnoreAttributeTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/IgnoreAttributeTests.cs
new file mode 100644
index 0000000..3ee4cd9
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/IgnoreAttributeTests.cs
@@ -0,0 +1,106 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using CsvHelper.Configuration;
+using CsvHelper.Tests.Mocks;
+using Xunit;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CsvHelper.Tests.Mappings.ConstructorParameter
+{
+
+ public class IgnoreAttributeTests
+ {
+ [Fact]
+ public void AutoMap_WithIgnoreAttributes_ConfiguresParameterMaps()
+ {
+ var context = new CsvContext(new CsvConfiguration(CultureInfo.InvariantCulture));
+ var map = context.AutoMap<Foo>();
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.Equal("id", map.ParameterMaps[0].Data.Names.First());
+ Assert.Equal("name", map.ParameterMaps[1].Data.Names.First());
+ Assert.True(map.ParameterMaps[1].Data.Ignore);
+ }
+
+ [Fact]
+ public void GetRecords_WithIgnoreAttributes_HasHeader_CreatesRecords()
+ {
+ var parser = new ParserMock
+ {
+ { "id" },
+ { "1" },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Null(records[0].Name);
+ }
+ }
+
+ [Fact]
+ public void GetRecords_WithIgnoreAttributes_NoHeader_CreatesRecords()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture)
+ {
+ HasHeaderRecord = false,
+ };
+ var parser = new ParserMock(config)
+ {
+ { "1" },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Null(records[0].Name);
+ }
+ }
+
+ [Fact]
+ public void WriteRecords_WithIgnoreAttributes_DoesntUseParameterMaps()
+ {
+ var records = new List<Foo>
+ {
+ new Foo(1, null),
+ };
+
+ using (var writer = new StringWriter())
+ using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+ {
+ csv.WriteRecords(records);
+
+ var expected = new StringBuilder();
+ expected.Append("Id,Name\r\n");
+ expected.Append("1,\r\n");
+
+ Assert.Equal(expected.ToString(), writer.ToString());
+ }
+ }
+
+ private class Foo
+ {
+ public int Id { get; private set; }
+
+ public string Name { get; private set; }
+
+ public Foo(int id, [CsvHelper.Configuration.Attributes.Ignore] string name)
+ {
+ Id = id;
+ Name = name;
+ }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/IgnoreMapTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/IgnoreMapTests.cs
new file mode 100644
index 0000000..247f4ab
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/IgnoreMapTests.cs
@@ -0,0 +1,150 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using CsvHelper.Configuration;
+using CsvHelper.Configuration.Attributes;
+using CsvHelper.Tests.Mocks;
+using Xunit;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CsvHelper.Tests.Mappings.ConstructorParameter
+{
+
+ public class IgnoreMapTests
+ {
+ [Fact]
+ public void Parameter_WithName_CreatesParameterMaps()
+ {
+ var map = new DefaultClassMap<Foo>();
+ map.Parameter("id");
+ map.Parameter("name").Ignore();
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.False(map.ParameterMaps[0].Data.Ignore);
+ Assert.True(map.ParameterMaps[1].Data.Ignore);
+ }
+
+ [Fact]
+ public void Parameter_WithConstructorFunctionAndName_CreatesParameterMaps()
+ {
+ var map = new DefaultClassMap<Foo>();
+ map.Parameter(() => ConfigurationFunctions.GetConstructor(new GetConstructorArgs(typeof(Foo))), "id");
+ map.Parameter(() => ConfigurationFunctions.GetConstructor(new GetConstructorArgs(typeof(Foo))), "name").Ignore();
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.False(map.ParameterMaps[0].Data.Ignore);
+ Assert.True(map.ParameterMaps[1].Data.Ignore);
+ }
+
+ [Fact]
+ public void Parameter_WithConstructorAndProperty_CreatesParameterMaps()
+ {
+ var constructor = ConfigurationFunctions.GetConstructor(new GetConstructorArgs(typeof(Foo)));
+ var parameters = constructor.GetParameters();
+
+ var map = new DefaultClassMap<Foo>();
+ map.Parameter(constructor, parameters[0]);
+ map.Parameter(constructor, parameters[1]).Ignore();
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.False(map.ParameterMaps[0].Data.Ignore);
+ Assert.True(map.ParameterMaps[1].Data.Ignore);
+ }
+
+ [Fact]
+ public void GetRecords_WithParameterMap_HasHeader_CreatesRecords()
+ {
+ var parser = new ParserMock
+ {
+ { "id" },
+ { "1" },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ var map = csv.Context.RegisterClassMap<FooMap>();
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Null(records[0].Name);
+ }
+ }
+
+ [Fact]
+ public void GetRecords_WithParameterMap_NoHeader_CreatesRecords()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture)
+ {
+ HasHeaderRecord = false,
+ };
+ var parser = new ParserMock(config)
+ {
+ { "1" },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ csv.Context.RegisterClassMap<FooMap>();
+
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Null(records[0].Name);
+ }
+ }
+
+ [Fact]
+ public void WriteRecords_WithParameterMap_DoesntUseParameterMaps()
+ {
+ var records = new List<Foo>
+ {
+ new Foo(1, "one"),
+ };
+
+ using (var writer = new StringWriter())
+ using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+ {
+ csv.Context.RegisterClassMap<FooMap>();
+
+ csv.WriteRecords(records);
+
+ var expected = new StringBuilder();
+ expected.Append("Id,Name\r\n");
+ expected.Append("1,one\r\n");
+
+ Assert.Equal(expected.ToString(), writer.ToString());
+ }
+ }
+
+ private class Foo
+ {
+ public int Id { get; private set; }
+
+ public string Name { get; private set; }
+
+ public Foo(int id, string name)
+ {
+ Id = id;
+ Name = name;
+ }
+ }
+
+ private class FooMap : ClassMap<Foo>
+ {
+ public FooMap()
+ {
+ Map(m => m.Id);
+ Map(m => m.Name);
+ Parameter("id");
+ Parameter("name").Ignore();
+ }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/IndexAttributeTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/IndexAttributeTests.cs
new file mode 100644
index 0000000..b2a236c
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/IndexAttributeTests.cs
@@ -0,0 +1,106 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using CsvHelper.Configuration;
+using CsvHelper.Configuration.Attributes;
+using CsvHelper.Tests.Mocks;
+using Xunit;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CsvHelper.Tests.Mappings.ConstructorParameter
+{
+
+ public class IndexAttributeTests
+ {
+ [Fact]
+ public void AutoMap_WithIndexAttributes_ConfiguresParameterMaps()
+ {
+ var context = new CsvContext(new CsvConfiguration(CultureInfo.InvariantCulture));
+ var map = context.AutoMap<Foo>();
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.Equal(0, map.ParameterMaps[0].Data.Index);
+ Assert.Equal(1, map.ParameterMaps[1].Data.Index);
+ }
+
+ [Fact]
+ public void GetRecords_WithIndexAttributes_HasHeader_CreatesRecords()
+ {
+ var parser = new ParserMock
+ {
+ { "Id", "Name" },
+ { "1", "one" },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal("one", records[0].Name);
+ }
+ }
+
+ [Fact]
+ public void GetRecords_WithIndexAttributes_NoHeader_CreatesRecords()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture)
+ {
+ HasHeaderRecord = false,
+ };
+ var parser = new ParserMock(config)
+ {
+ { "1", "one" },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal("one", records[0].Name);
+ }
+ }
+
+ [Fact]
+ public void WriteRecords_WithIndexAttributes_DoesntUseParameterMaps()
+ {
+ var records = new List<Foo>
+ {
+ new Foo(1, "one"),
+ };
+
+ using (var writer = new StringWriter())
+ using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+ {
+ csv.WriteRecords(records);
+
+ var expected = new StringBuilder();
+ expected.Append("Id,Name\r\n");
+ expected.Append("1,one\r\n");
+
+ Assert.Equal(expected.ToString(), writer.ToString());
+ }
+ }
+
+ private class Foo
+ {
+ public int Id { get; private set; }
+
+ public string Name { get; private set; }
+
+ public Foo([Index(0)] int id, [Index(1)] string name)
+ {
+ Id = id;
+ Name = name;
+ }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/IndexMapTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/IndexMapTests.cs
new file mode 100644
index 0000000..fcb4c6e
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/IndexMapTests.cs
@@ -0,0 +1,149 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using CsvHelper.Configuration;
+using CsvHelper.Tests.Mocks;
+using Xunit;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CsvHelper.Tests.Mappings.ConstructorParameter
+{
+
+ public class IndexMapTests
+ {
+ [Fact]
+ public void Parameter_WithName_CreatesParameterMaps()
+ {
+ var map = new DefaultClassMap<Foo>();
+ map.Parameter("id").Index(0);
+ map.Parameter("name").Index(1);
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.Equal(0, map.ParameterMaps[0].Data.Index);
+ Assert.Equal(1, map.ParameterMaps[1].Data.Index);
+ }
+
+ [Fact]
+ public void Parameter_WithConstructorFunctionAndName_CreatesParameterMaps()
+ {
+ var map = new DefaultClassMap<Foo>();
+ map.Parameter(() => ConfigurationFunctions.GetConstructor(new GetConstructorArgs(typeof(Foo))), "id").Index(0);
+ map.Parameter(() => ConfigurationFunctions.GetConstructor(new GetConstructorArgs(typeof(Foo))), "name").Index(1);
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.Equal(0, map.ParameterMaps[0].Data.Index);
+ Assert.Equal(1, map.ParameterMaps[1].Data.Index);
+ }
+
+ [Fact]
+ public void Parameter_WithConstructorAndProperty_CreatesParameterMaps()
+ {
+ var constructor = ConfigurationFunctions.GetConstructor(new GetConstructorArgs(typeof(Foo)));
+ var parameters = constructor.GetParameters();
+
+ var map = new DefaultClassMap<Foo>();
+ map.Parameter(constructor, parameters[0]).Index(0);
+ map.Parameter(constructor, parameters[1]).Index(1);
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.Equal(0, map.ParameterMaps[0].Data.Index);
+ Assert.Equal(1, map.ParameterMaps[1].Data.Index);
+ }
+
+ [Fact]
+ public void GetRecords_WithParameterMap_HasHeader_CreatesRecords()
+ {
+ var parser = new ParserMock
+ {
+ { "Id", "Name" },
+ { "1", "one" },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ var map = csv.Context.RegisterClassMap<FooMap>();
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal("one", records[0].Name);
+ }
+ }
+
+ [Fact]
+ public void GetRecords_WithParameterMap_NoHeader_CreatesRecords()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture)
+ {
+ HasHeaderRecord = false,
+ };
+ var parser = new ParserMock(config)
+ {
+ { "1", "one" },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ csv.Context.RegisterClassMap<FooMap>();
+
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal("one", records[0].Name);
+ }
+ }
+
+ [Fact]
+ public void WriteRecords_WithParameterMap_DoesntUseParameterMaps()
+ {
+ var records = new List<Foo>
+ {
+ new Foo(1, "one"),
+ };
+
+ using (var writer = new StringWriter())
+ using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+ {
+ csv.Context.RegisterClassMap<FooMap>();
+
+ csv.WriteRecords(records);
+
+ var expected = new StringBuilder();
+ expected.Append("Id,Name\r\n");
+ expected.Append("1,one\r\n");
+
+ Assert.Equal(expected.ToString(), writer.ToString());
+ }
+ }
+
+ private class Foo
+ {
+ public int Id { get; private set; }
+
+ public string Name { get; private set; }
+
+ public Foo(int id, string name)
+ {
+ Id = id;
+ Name = name;
+ }
+ }
+
+ private class FooMap : ClassMap<Foo>
+ {
+ public FooMap()
+ {
+ Map(m => m.Id);
+ Map(m => m.Name);
+ Parameter("id").Index(0);
+ Parameter("name").Index(1);
+ }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/NameAttributeTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/NameAttributeTests.cs
new file mode 100644
index 0000000..25c3586
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/NameAttributeTests.cs
@@ -0,0 +1,85 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using CsvHelper.Configuration;
+using CsvHelper.Configuration.Attributes;
+using CsvHelper.Tests.Mocks;
+using Xunit;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CsvHelper.Tests.Mappings.ConstructorParameter
+{
+
+ public class NameAttributeTests
+ {
+ [Fact]
+ public void AutoMap_WithNameAttributes_ConfiguresParameterMaps()
+ {
+ var context = new CsvContext(new CsvConfiguration(CultureInfo.InvariantCulture));
+ var map = context.AutoMap<Foo>();
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.Equal("Id", map.ParameterMaps[0].Data.Names[0]);
+ Assert.Equal("Name", map.ParameterMaps[1].Data.Names[0]);
+ }
+
+ [Fact]
+ public void GetRecords_WithNameAttributes_HasHeader_CreatesRecords()
+ {
+ var parser = new ParserMock
+ {
+ { "Id", "Name" },
+ { "1", "one" },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal("one", records[0].Name);
+ }
+ }
+
+ [Fact]
+ public void WriteRecords_WithNameAttributes_DoesntUseParameterMaps()
+ {
+ var records = new List<Foo>
+ {
+ new Foo(1, "one"),
+ };
+
+ using (var writer = new StringWriter())
+ using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+ {
+ csv.WriteRecords(records);
+
+ var expected = new StringBuilder();
+ expected.Append("Id,Name\r\n");
+ expected.Append("1,one\r\n");
+
+ Assert.Equal(expected.ToString(), writer.ToString());
+ }
+ }
+
+ private class Foo
+ {
+ public int Id { get; private set; }
+
+ public string Name { get; private set; }
+
+ public Foo([Name("Id")] int id, [Name("Name")] string name)
+ {
+ Id = id;
+ Name = name;
+ }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/NameIndexAttributeTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/NameIndexAttributeTests.cs
new file mode 100644
index 0000000..55f009f
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/NameIndexAttributeTests.cs
@@ -0,0 +1,85 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using CsvHelper.Configuration;
+using CsvHelper.Configuration.Attributes;
+using CsvHelper.Tests.Mocks;
+using Xunit;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CsvHelper.Tests.Mappings.ConstructorParameter
+{
+
+ public class NameIndexAttributeTests
+ {
+ [Fact]
+ public void AutoMap_WithNameAttributes_ConfiguresParameterMaps()
+ {
+ var context = new CsvContext(new CsvConfiguration(CultureInfo.InvariantCulture));
+ var map = context.AutoMap<Foo>();
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.Equal(0, map.ParameterMaps[0].Data.NameIndex);
+ Assert.Equal(1, map.ParameterMaps[1].Data.NameIndex);
+ }
+
+ [Fact]
+ public void GetRecords_WithNameAttributes_HasHeader_CreatesRecords()
+ {
+ var parser = new ParserMock
+ {
+ { "Id", "Name", "Name" },
+ { "1", "", "one" },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal("one", records[0].Name);
+ }
+ }
+
+ [Fact]
+ public void WriteRecords_WithNameAttributes_DoesntUseParameterMaps()
+ {
+ var records = new List<Foo>
+ {
+ new Foo(1, "one"),
+ };
+
+ using (var writer = new StringWriter())
+ using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+ {
+ csv.WriteRecords(records);
+
+ var expected = new StringBuilder();
+ expected.Append("Id,Name\r\n");
+ expected.Append("1,one\r\n");
+
+ Assert.Equal(expected.ToString(), writer.ToString());
+ }
+ }
+
+ private class Foo
+ {
+ public int Id { get; private set; }
+
+ public string Name { get; private set; }
+
+ public Foo([Name("Id")]int id, [Name("Name")][NameIndex(1)] string name)
+ {
+ Id = id;
+ Name = name;
+ }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/NameIndexMapTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/NameIndexMapTests.cs
new file mode 100644
index 0000000..5c8ed87
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/NameIndexMapTests.cs
@@ -0,0 +1,126 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using CsvHelper.Configuration;
+using CsvHelper.Tests.Mocks;
+using Xunit;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CsvHelper.Tests.Mappings.ConstructorParameter
+{
+
+ public class NameIndexMapTests
+ {
+ [Fact]
+ public void Parameter_WithName_CreatesParameterMaps()
+ {
+ var map = new DefaultClassMap<Foo>();
+ map.Parameter("id").NameIndex(0);
+ map.Parameter("name").NameIndex(1);
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.Equal(0, map.ParameterMaps[0].Data.NameIndex);
+ Assert.Equal(1, map.ParameterMaps[1].Data.NameIndex);
+ }
+
+ [Fact]
+ public void Parameter_WithConstructorFunctionAndName_CreatesParameterMaps()
+ {
+ var map = new DefaultClassMap<Foo>();
+ map.Parameter(() => ConfigurationFunctions.GetConstructor(new GetConstructorArgs(typeof(Foo))), "id").NameIndex(0);
+ map.Parameter(() => ConfigurationFunctions.GetConstructor(new GetConstructorArgs(typeof(Foo))), "name").NameIndex(1);
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.Equal(0, map.ParameterMaps[0].Data.NameIndex);
+ Assert.Equal(1, map.ParameterMaps[1].Data.NameIndex);
+ }
+
+ [Fact]
+ public void Parameter_WithConstructorAndProperty_CreatesParameterMaps()
+ {
+ var constructor = ConfigurationFunctions.GetConstructor(new GetConstructorArgs(typeof(Foo)));
+ var parameters = constructor.GetParameters();
+
+ var map = new DefaultClassMap<Foo>();
+ map.Parameter(constructor, parameters[0]).NameIndex(0);
+ map.Parameter(constructor, parameters[1]).NameIndex(1);
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.Equal(0, map.ParameterMaps[0].Data.NameIndex);
+ Assert.Equal(1, map.ParameterMaps[1].Data.NameIndex);
+ }
+
+ [Fact]
+ public void GetRecords_WithParameterMap_HasHeader_CreatesRecords()
+ {
+ var parser = new ParserMock
+ {
+ { "Id", "Name", "Name" },
+ { "1", "", "one" },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ csv.Context.RegisterClassMap<FooMap>();
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal("one", records[0].Name);
+ }
+ }
+
+ [Fact]
+ public void WriteRecords()
+ {
+ var records = new List<Foo>
+ {
+ new Foo(1, "one"),
+ };
+
+ using (var writer = new StringWriter())
+ using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+ {
+ csv.Context.RegisterClassMap<FooMap>();
+
+ csv.WriteRecords(records);
+
+ var expected = new StringBuilder();
+ expected.Append("Id,Name\r\n");
+ expected.Append("1,one\r\n");
+
+ Assert.Equal(expected.ToString(), writer.ToString());
+ }
+ }
+
+ private class Foo
+ {
+ public int Id { get; private set; }
+
+ public string Name { get; private set; }
+
+ public Foo(int id, string name)
+ {
+ Id = id;
+ Name = name;
+ }
+ }
+
+ private class FooMap : ClassMap<Foo>
+ {
+ public FooMap()
+ {
+ Map(m => m.Id);
+ Map(m => m.Name);
+ Parameter("id").Name("Id");
+ Parameter("name").Name("Name").NameIndex(1);
+ }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/NameMapTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/NameMapTests.cs
new file mode 100644
index 0000000..0413be7
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/NameMapTests.cs
@@ -0,0 +1,126 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using CsvHelper.Configuration;
+using CsvHelper.Tests.Mocks;
+using Xunit;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CsvHelper.Tests.Mappings.ConstructorParameter
+{
+
+ public class NameMapTests
+ {
+ [Fact]
+ public void Parameter_WithName_CreatesParameterMaps()
+ {
+ var map = new DefaultClassMap<Foo>();
+ map.Parameter("id").Name("Id");
+ map.Parameter("name").Name("Name");
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.Equal("Id", map.ParameterMaps[0].Data.Names[0]);
+ Assert.Equal("Name", map.ParameterMaps[1].Data.Names[0]);
+ }
+
+ [Fact]
+ public void Parameter_WithConstructorFunctionAndName_CreatesParameterMaps()
+ {
+ var map = new DefaultClassMap<Foo>();
+ map.Parameter(() => ConfigurationFunctions.GetConstructor(new GetConstructorArgs(typeof(Foo))), "id").Name("Id");
+ map.Parameter(() => ConfigurationFunctions.GetConstructor(new GetConstructorArgs(typeof(Foo))), "name").Name("Name");
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.Equal("Id", map.ParameterMaps[0].Data.Names[0]);
+ Assert.Equal("Name", map.ParameterMaps[1].Data.Names[0]);
+ }
+
+ [Fact]
+ public void Parameter_WithConstructorAndProperty_CreatesParameterMaps()
+ {
+ var constructor = ConfigurationFunctions.GetConstructor(new GetConstructorArgs(typeof(Foo)));
+ var parameters = constructor.GetParameters();
+
+ var map = new DefaultClassMap<Foo>();
+ map.Parameter(constructor, parameters[0]).Name("Id");
+ map.Parameter(constructor, parameters[1]).Name("Name");
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.Equal("Id", map.ParameterMaps[0].Data.Names[0]);
+ Assert.Equal("Name", map.ParameterMaps[1].Data.Names[0]);
+ }
+
+ [Fact]
+ public void GetRecords_WithParameterMap_HasHeader_CreatesRecords()
+ {
+ var parser = new ParserMock
+ {
+ { "Id", "Name" },
+ { "1", "one" },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ csv.Context.RegisterClassMap<FooMap>();
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal("one", records[0].Name);
+ }
+ }
+
+ [Fact]
+ public void WriteRecords()
+ {
+ var records = new List<Foo>
+ {
+ new Foo(1, "one"),
+ };
+
+ using (var writer = new StringWriter())
+ using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+ {
+ csv.Context.RegisterClassMap<FooMap>();
+
+ csv.WriteRecords(records);
+
+ var expected = new StringBuilder();
+ expected.Append("Id,Name\r\n");
+ expected.Append("1,one\r\n");
+
+ Assert.Equal(expected.ToString(), writer.ToString());
+ }
+ }
+
+ private class Foo
+ {
+ public int Id { get; private set; }
+
+ public string Name { get; private set; }
+
+ public Foo(int id, string name)
+ {
+ Id = id;
+ Name = name;
+ }
+ }
+
+ private class FooMap : ClassMap<Foo>
+ {
+ public FooMap()
+ {
+ Map(m => m.Id);
+ Map(m => m.Name);
+ Parameter("id").Name("Id");
+ Parameter("name").Name("Name");
+ }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/NullValuesAttributeTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/NullValuesAttributeTests.cs
new file mode 100644
index 0000000..0f9dd76
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/NullValuesAttributeTests.cs
@@ -0,0 +1,107 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using CsvHelper.Configuration;
+using CsvHelper.Configuration.Attributes;
+using CsvHelper.Tests.Mocks;
+using Xunit;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CsvHelper.Tests.Mappings.ConstructorParameter
+{
+
+ public class NullValuesAttributeTests
+ {
+ [Fact]
+ public void AutoMap_WithBooleanFalseValuesAttribute_CreatesParameterMaps()
+ {
+ var context = new CsvContext(new CsvConfiguration(CultureInfo.InvariantCulture));
+ var map = context.AutoMap<Foo>();
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.Empty(map.ParameterMaps[0].Data.TypeConverterOptions.NullValues);
+ Assert.Single(map.ParameterMaps[1].Data.TypeConverterOptions.NullValues);
+ Assert.Equal("NULL", map.ParameterMaps[1].Data.TypeConverterOptions.NullValues[0]);
+ }
+
+ [Fact]
+ public void GetRecords_WithBooleanFalseValuesAttribute_HasHeader_CreatesRecords()
+ {
+ var parser = new ParserMock
+ {
+ { "id", "name" },
+ { "1", "NULL" },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Null(records[0].Name);
+ }
+ }
+
+ [Fact]
+ public void GetRecords_WithBooleanFalseValuesAttribute_NoHeader_CreatesRecords()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture)
+ {
+ HasHeaderRecord = false,
+ };
+ var parser = new ParserMock(config)
+ {
+ { "1", "NULL" },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Null(records[0].Name);
+ }
+ }
+
+ [Fact]
+ public void WriteRecords_WithBooleanFalseValuesAttribute_DoesntUseParameterMaps()
+ {
+ var records = new List<Foo>
+ {
+ new Foo(1, null),
+ };
+
+ using (var writer = new StringWriter())
+ using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+ {
+ csv.WriteRecords(records);
+
+ var expected = new StringBuilder();
+ expected.Append("Id,Name\r\n");
+ expected.Append("1,\r\n");
+
+ Assert.Equal(expected.ToString(), writer.ToString());
+ }
+ }
+
+ private class Foo
+ {
+ public int Id { get; private set; }
+
+ public string Name { get; private set; }
+
+ public Foo(int id, [NullValues("NULL")] string name)
+ {
+ Id = id;
+ Name = name;
+ }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/NullValuesMapTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/NullValuesMapTests.cs
new file mode 100644
index 0000000..2362248
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/NullValuesMapTests.cs
@@ -0,0 +1,122 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using CsvHelper.Configuration;
+using CsvHelper.Tests.Mocks;
+using Xunit;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CsvHelper.Tests.Mappings.ConstructorParameter
+{
+
+ public class NullValuesMapTests
+ {
+ [Fact]
+ public void AutoMap_WithBooleanFalseValuesAttribute_CreatesParameterMaps()
+ {
+ var map = new DefaultClassMap<Foo>();
+ map.Parameter("id");
+ map.Parameter("name").TypeConverterOption.NullValues("NULL");
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.Empty(map.ParameterMaps[0].Data.TypeConverterOptions.NullValues);
+ Assert.Single(map.ParameterMaps[1].Data.TypeConverterOptions.NullValues);
+ Assert.Equal("NULL", map.ParameterMaps[1].Data.TypeConverterOptions.NullValues[0]);
+ }
+
+ [Fact]
+ public void GetRecords_WithBooleanFalseValuesAttribute_HasHeader_CreatesRecords()
+ {
+ var parser = new ParserMock
+ {
+ new [] { "id", "name" },
+ new [] { "1", "NULL" },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ csv.Context.RegisterClassMap<FooMap>();
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Null(records[0].Name);
+ }
+ }
+
+ [Fact]
+ public void GetRecords_WithBooleanFalseValuesAttribute_NoHeader_CreatesRecords()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture)
+ {
+ HasHeaderRecord = false,
+ };
+ var parser = new ParserMock(config)
+ {
+ { "1", "NULL" },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ csv.Context.RegisterClassMap<FooMap>();
+
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Null(records[0].Name);
+ }
+ }
+
+ [Fact]
+ public void WriteRecords_WithBooleanFalseValuesAttribute_DoesntUseParameterMaps()
+ {
+ var records = new List<Foo>
+ {
+ new Foo(1, null),
+ };
+
+ using (var writer = new StringWriter())
+ using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+ {
+ csv.Context.RegisterClassMap<FooMap>();
+ csv.WriteRecords(records);
+
+ var expected = new StringBuilder();
+ expected.Append("Id,Name\r\n");
+ expected.Append("1,\r\n");
+
+ Assert.Equal(expected.ToString(), writer.ToString());
+ }
+ }
+
+ private class Foo
+ {
+ public int Id { get; private set; }
+
+ public string Name { get; private set; }
+
+ public Foo(int id, string name)
+ {
+ Id = id;
+ Name = name;
+ }
+ }
+
+ private class FooMap : ClassMap<Foo>
+ {
+ public FooMap()
+ {
+ Map(m => m.Id);
+ Map(m => m.Name);
+ Parameter("id");
+ Parameter("name").TypeConverterOption.NullValues("NULL");
+ }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/NumberStylesAttributeTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/NumberStylesAttributeTests.cs
new file mode 100644
index 0000000..c805b41
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/NumberStylesAttributeTests.cs
@@ -0,0 +1,108 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using CsvHelper.Configuration;
+using CsvHelper.Configuration.Attributes;
+using CsvHelper.Tests.Mocks;
+using Xunit;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CsvHelper.Tests.Mappings.ConstructorParameter
+{
+
+ public class NumberStylesAttributeTests
+ {
+ private const decimal amount = 123;
+
+ [Fact]
+ public void AutoMap_WithCultureInfoAttributes_ConfiguresParameterMaps()
+ {
+ var context = new CsvContext(new CsvConfiguration(CultureInfo.InvariantCulture));
+ var map = context.AutoMap<Foo>();
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.Null(map.ParameterMaps[0].Data.TypeConverterOptions.NumberStyles);
+ Assert.Equal(NumberStyles.AllowParentheses, map.ParameterMaps[1].Data.TypeConverterOptions.NumberStyles);
+ }
+
+ [Fact]
+ public void GetRecords_WithCultureInfoAttributes_HasHeader_CreatesRecords()
+ {
+ var parser = new ParserMock
+ {
+ { "id", "amount" },
+ { "1", $"({amount})" },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal(-amount, records[0].Amount);
+ }
+ }
+
+ [Fact]
+ public void GetRecords_WithCultureInfoAttributes_NoHeader_CreatesRecords()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture)
+ {
+ HasHeaderRecord = false,
+ };
+ var parser = new ParserMock(config)
+ {
+ { "1", $"({amount})" },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal(-amount, records[0].Amount);
+ }
+ }
+
+ [Fact]
+ public void WriteRecords_WithCultureInfoAttributes_DoesntUseParameterMaps()
+ {
+ var records = new List<Foo>
+ {
+ new Foo(1, amount),
+ };
+
+ using (var writer = new StringWriter())
+ using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+ {
+ csv.WriteRecords(records);
+
+ var expected = new StringBuilder();
+ expected.Append("Id,Amount\r\n");
+ expected.Append($"1,{amount}\r\n");
+
+ Assert.Equal(expected.ToString(), writer.ToString());
+ }
+ }
+
+ private class Foo
+ {
+ public int Id { get; private set; }
+
+ public decimal Amount { get; private set; }
+
+ public Foo(int id, [NumberStyles(NumberStyles.AllowParentheses)] decimal amount)
+ {
+ Id = id;
+ Amount = amount;
+ }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/NumberStylesMapTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/NumberStylesMapTests.cs
new file mode 100644
index 0000000..19fdae8
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/NumberStylesMapTests.cs
@@ -0,0 +1,151 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using CsvHelper.Configuration;
+using CsvHelper.Tests.Mocks;
+using Xunit;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CsvHelper.Tests.Mappings.ConstructorParameter
+{
+
+ public class NumberStylesMapTests
+ {
+ private const decimal amount = 123;
+
+ [Fact]
+ public void Parameter_WithName_CreatesParameterMaps()
+ {
+ var map = new DefaultClassMap<Foo>();
+ map.Parameter("id");
+ map.Parameter("amount").TypeConverterOption.NumberStyles(NumberStyles.AllowParentheses);
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.Null(map.ParameterMaps[0].Data.TypeConverterOptions.NumberStyles);
+ Assert.Equal(NumberStyles.AllowParentheses, map.ParameterMaps[1].Data.TypeConverterOptions.NumberStyles);
+ }
+
+ [Fact]
+ public void Parameter_WithConstructorFunctionAndName_CreatesParameterMaps()
+ {
+ var map = new DefaultClassMap<Foo>();
+ map.Parameter(() => ConfigurationFunctions.GetConstructor(new GetConstructorArgs(typeof(Foo))), "id");
+ map.Parameter(() => ConfigurationFunctions.GetConstructor(new GetConstructorArgs(typeof(Foo))), "amount").TypeConverterOption.NumberStyles(NumberStyles.AllowParentheses);
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.Null(map.ParameterMaps[0].Data.TypeConverterOptions.NumberStyles);
+ Assert.Equal(NumberStyles.AllowParentheses, map.ParameterMaps[1].Data.TypeConverterOptions.NumberStyles);
+ }
+
+ [Fact]
+ public void Parameter_WithConstructorAndProperty_CreatesParameterMaps()
+ {
+ var constructor = ConfigurationFunctions.GetConstructor(new GetConstructorArgs(typeof(Foo)));
+ var parameters = constructor.GetParameters();
+
+ var map = new DefaultClassMap<Foo>();
+ map.Parameter(constructor, parameters[0]);
+ map.Parameter(constructor, parameters[1]).TypeConverterOption.NumberStyles(NumberStyles.AllowParentheses);
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.Null(map.ParameterMaps[0].Data.TypeConverterOptions.NumberStyles);
+ Assert.Equal(NumberStyles.AllowParentheses, map.ParameterMaps[1].Data.TypeConverterOptions.NumberStyles);
+ }
+
+ [Fact]
+ public void GetRecords_WithParameterMap_HasHeader_CreatesRecords()
+ {
+ var parser = new ParserMock
+ {
+ { "id", "amount" },
+ { "1", $"({amount})" },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ var map = csv.Context.RegisterClassMap<FooMap>();
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal(-amount, records[0].Amount);
+ }
+ }
+
+ [Fact]
+ public void GetRecords_WithParameterMap_NoHeader_CreatesRecords()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture)
+ {
+ HasHeaderRecord = false,
+ };
+ var parser = new ParserMock(config)
+ {
+ { "1", $"({amount})" },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ csv.Context.RegisterClassMap<FooMap>();
+
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal(-amount, records[0].Amount);
+ }
+ }
+
+ [Fact]
+ public void WriteRecords_WithParameterMap_DoesntUseParameterMaps()
+ {
+ var records = new List<Foo>
+ {
+ new Foo(1, amount),
+ };
+
+ using (var writer = new StringWriter())
+ using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+ {
+ csv.Context.RegisterClassMap<FooMap>();
+
+ csv.WriteRecords(records);
+
+ var expected = new StringBuilder();
+ expected.Append("Id,Amount\r\n");
+ expected.Append($"1,{amount}\r\n");
+
+ Assert.Equal(expected.ToString(), writer.ToString());
+ }
+ }
+
+ private class Foo
+ {
+ public int Id { get; private set; }
+
+ public decimal Amount { get; private set; }
+
+ public Foo(int id, decimal amount)
+ {
+ Id = id;
+ Amount = amount;
+ }
+ }
+
+ private class FooMap : ClassMap<Foo>
+ {
+ public FooMap()
+ {
+ Map(m => m.Id);
+ Map(m => m.Amount);
+ Parameter("id");
+ Parameter("amount").TypeConverterOption.NumberStyles(NumberStyles.AllowParentheses);
+ }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/OptionalAttributeTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/OptionalAttributeTests.cs
new file mode 100644
index 0000000..2e7b8b4
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/OptionalAttributeTests.cs
@@ -0,0 +1,106 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using CsvHelper.Configuration;
+using CsvHelper.Configuration.Attributes;
+using CsvHelper.Tests.Mocks;
+using Xunit;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CsvHelper.Tests.Mappings.ConstructorParameter
+{
+
+ public class OptionalAttributeTests
+ {
+ [Fact]
+ public void AutoMap_WithConstantAttributes_ConfiguresParameterMaps()
+ {
+ var context = new CsvContext(new CsvConfiguration(CultureInfo.InvariantCulture));
+ var map = context.AutoMap<Foo>();
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.False(map.ParameterMaps[0].Data.IsOptional);
+ Assert.True(map.ParameterMaps[1].Data.IsOptional);
+ }
+
+ [Fact]
+ public void GetRecords_WithConstantAttributes_HasHeader_CreatesRecords()
+ {
+ var parser = new ParserMock
+ {
+ { "id" },
+ { "1" },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Null(records[0].Name);
+ }
+ }
+
+ [Fact]
+ public void GetRecords_WithConstantAttributes_NoHeader_CreatesRecords()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture)
+ {
+ HasHeaderRecord = false,
+ };
+ var parser = new ParserMock(config)
+ {
+ { "1" },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Null(records[0].Name);
+ }
+ }
+
+ [Fact]
+ public void WriteRecords_WithConstantAttributes_DoesntUseParameterMaps()
+ {
+ var records = new List<Foo>
+ {
+ new Foo(1, null),
+ };
+
+ using (var writer = new StringWriter())
+ using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+ {
+ csv.WriteRecords(records);
+
+ var expected = new StringBuilder();
+ expected.Append("Id,Name\r\n");
+ expected.Append("1,\r\n");
+
+ Assert.Equal(expected.ToString(), writer.ToString());
+ }
+ }
+
+ private class Foo
+ {
+ public int Id { get; private set; }
+
+ public string Name { get; private set; }
+
+ public Foo(int id, [Optional] string name)
+ {
+ Id = id;
+ Name = name;
+ }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/OptionalMapTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/OptionalMapTests.cs
new file mode 100644
index 0000000..bae94d1
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/OptionalMapTests.cs
@@ -0,0 +1,150 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using CsvHelper.Configuration;
+using CsvHelper.Tests.Mocks;
+using Xunit;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CsvHelper.Tests.Mappings.ConstructorParameter
+{
+
+ public class OptionalMapTests
+ {
+ [Fact]
+ public void Parameter_WithName_CreatesParameterMaps()
+ {
+ var map = new DefaultClassMap<Foo>();
+ map.Parameter("id");
+ map.Parameter("name").Optional();
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.False(map.ParameterMaps[0].Data.IsOptional);
+ Assert.True(map.ParameterMaps[1].Data.IsOptional);
+ }
+
+ [Fact]
+ public void Parameter_WithConstructorFunctionAndName_CreatesParameterMaps()
+ {
+ var map = new DefaultClassMap<Foo>();
+ map.Parameter(() => ConfigurationFunctions.GetConstructor(new GetConstructorArgs(typeof(Foo))), "id");
+ map.Parameter(() => ConfigurationFunctions.GetConstructor(new GetConstructorArgs(typeof(Foo))), "name").Optional();
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.False(map.ParameterMaps[0].Data.IsOptional);
+ Assert.True(map.ParameterMaps[1].Data.IsOptional);
+ }
+
+ [Fact]
+ public void Parameter_WithConstructorAndProperty_CreatesParameterMaps()
+ {
+ var constructor = ConfigurationFunctions.GetConstructor(new GetConstructorArgs(typeof(Foo)));
+ var parameters = constructor.GetParameters();
+
+ var map = new DefaultClassMap<Foo>();
+ map.Parameter(constructor, parameters[0]);
+ map.Parameter(constructor, parameters[1]).Optional();
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.False(map.ParameterMaps[0].Data.IsOptional);
+ Assert.True(map.ParameterMaps[1].Data.IsOptional);
+ }
+
+ [Fact]
+ public void GetRecords_WithParameterMap_HasHeader_CreatesRecords()
+ {
+ var parser = new ParserMock
+ {
+ { "id" },
+ { "1" },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ var map = csv.Context.RegisterClassMap<FooMap>();
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Null(records[0].Name);
+ }
+ }
+
+ [Fact]
+ public void GetRecords_WithParameterMap_NoHeader_CreatesRecords()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture)
+ {
+ HasHeaderRecord = false,
+ };
+ var parser = new ParserMock(config)
+ {
+ { "1" },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ csv.Context.RegisterClassMap<FooMap>();
+
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Null(records[0].Name);
+ }
+ }
+
+ [Fact]
+ public void WriteRecords_WithParameterMap_DoesntUseParameterMaps()
+ {
+ var records = new List<Foo>
+ {
+ new Foo(1, null),
+ };
+
+ using (var writer = new StringWriter())
+ using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+ {
+ csv.Context.RegisterClassMap<FooMap>();
+
+ csv.WriteRecords(records);
+
+ var expected = new StringBuilder();
+ expected.Append("Id,Name\r\n");
+ expected.Append("1,\r\n");
+
+ Assert.Equal(expected.ToString(), writer.ToString());
+ }
+ }
+
+ private class Foo
+ {
+ public int Id { get; private set; }
+
+ public string Name { get; private set; }
+
+ public Foo(int id, string name)
+ {
+ Id = id;
+ Name = name;
+ }
+ }
+
+ private class FooMap : ClassMap<Foo>
+ {
+ public FooMap()
+ {
+ Map(m => m.Id);
+ Map(m => m.Name);
+ Parameter("id");
+ Parameter("name").Optional();
+ }
+ }
+
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/TypeConverterAttributeTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/TypeConverterAttributeTests.cs
new file mode 100644
index 0000000..4d6cd2a
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/TypeConverterAttributeTests.cs
@@ -0,0 +1,115 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using CsvHelper.Configuration;
+using CsvHelper.Configuration.Attributes;
+using CsvHelper.Tests.Mocks;
+using CsvHelper.TypeConversion;
+using Xunit;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CsvHelper.Tests.Mappings.ConstructorParameter
+{
+
+ public class TypeConverterAttributeTests
+ {
+ [Fact]
+ public void AutoMap_WithConstantAttributes_ConfiguresParameterMaps()
+ {
+ var context = new CsvContext(new CsvConfiguration(CultureInfo.InvariantCulture));
+ var map = context.AutoMap<Foo>();
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.IsType<Int32Converter>(map.ParameterMaps[0].Data.TypeConverter);
+ Assert.IsType<CustomConverter>(map.ParameterMaps[1].Data.TypeConverter);
+ }
+
+ [Fact]
+ public void GetRecords_WithConstantAttributes_HasHeader_CreatesRecords()
+ {
+ var parser = new ParserMock
+ {
+ { "id", "name" },
+ { "1", "one" },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal("Bar", records[0].Name);
+ }
+ }
+
+ [Fact]
+ public void GetRecords_WithConstantAttributes_NoHeader_CreatesRecords()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture)
+ {
+ HasHeaderRecord = false,
+ };
+ var parser = new ParserMock(config)
+ {
+ { "1", "one" },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal("Bar", records[0].Name);
+ }
+ }
+
+ [Fact]
+ public void WriteRecords_WithConstantAttributes_DoesntUseParameterMaps()
+ {
+ var records = new List<Foo>
+ {
+ new Foo(1, null),
+ };
+
+ using (var writer = new StringWriter())
+ using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+ {
+ csv.WriteRecords(records);
+
+ var expected = new StringBuilder();
+ expected.Append("Id,Name\r\n");
+ expected.Append("1,\r\n");
+
+ Assert.Equal(expected.ToString(), writer.ToString());
+ }
+ }
+
+ private class Foo
+ {
+ public int Id { get; private set; }
+
+ public string Name { get; private set; }
+
+ public Foo(int id, [TypeConverter(typeof(CustomConverter))] string name)
+ {
+ Id = id;
+ Name = name;
+ }
+ }
+
+ private class CustomConverter : DefaultTypeConverter
+ {
+ public override object ConvertFromString(string text, IReaderRow row, MemberMapData memberMapData)
+ {
+ return "Bar";
+ }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/TypeConverterMapTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/TypeConverterMapTests.cs
new file mode 100644
index 0000000..98bc4dd
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ConstructorParameter/TypeConverterMapTests.cs
@@ -0,0 +1,158 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using CsvHelper.Configuration;
+using CsvHelper.Tests.Mocks;
+using CsvHelper.TypeConversion;
+using Xunit;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CsvHelper.Tests.Mappings.ConstructorParameter
+{
+
+ public class TypeConverterMapTests
+ {
+ [Fact]
+ public void Parameter_WithName_CreatesParameterMaps()
+ {
+ var map = new DefaultClassMap<Foo>();
+ map.Parameter("id");
+ map.Parameter("name").TypeConverter<CustomConverter>();
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.Null(map.ParameterMaps[0].Data.TypeConverter);
+ Assert.IsType<CustomConverter>(map.ParameterMaps[1].Data.TypeConverter);
+ }
+
+ [Fact]
+ public void Parameter_WithConstructorFunctionAndName_CreatesParameterMaps()
+ {
+ var map = new DefaultClassMap<Foo>();
+ map.Parameter(() => ConfigurationFunctions.GetConstructor(new GetConstructorArgs(typeof(Foo))), "id");
+ map.Parameter(() => ConfigurationFunctions.GetConstructor(new GetConstructorArgs(typeof(Foo))), "name").TypeConverter<CustomConverter>();
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.Null(map.ParameterMaps[0].Data.TypeConverter);
+ Assert.IsType<CustomConverter>(map.ParameterMaps[1].Data.TypeConverter);
+ }
+
+ [Fact]
+ public void Parameter_WithConstructorAndProperty_CreatesParameterMaps()
+ {
+ var constructor = ConfigurationFunctions.GetConstructor(new GetConstructorArgs(typeof(Foo)));
+ var parameters = constructor.GetParameters();
+
+ var map = new DefaultClassMap<Foo>();
+ map.Parameter(constructor, parameters[0]);
+ map.Parameter(constructor, parameters[1]).TypeConverter<CustomConverter>();
+
+ Assert.Equal(2, map.ParameterMaps.Count);
+ Assert.Null(map.ParameterMaps[0].Data.TypeConverter);
+ Assert.IsType<CustomConverter>(map.ParameterMaps[1].Data.TypeConverter);
+ }
+
+ [Fact]
+ public void GetRecords_WithParameterMap_HasHeader_CreatesRecords()
+ {
+ var parser = new ParserMock
+ {
+ { "id", "name" },
+ { "1", "one" },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ var map = csv.Context.RegisterClassMap<FooMap>();
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal("Bar", records[0].Name);
+ }
+ }
+
+ [Fact]
+ public void GetRecords_WithParameterMap_NoHeader_CreatesRecords()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture)
+ {
+ HasHeaderRecord = false,
+ };
+ var parser = new ParserMock(config)
+ {
+ { "1", "one" },
+ };
+ using (var csv = new CsvReader(parser))
+ {
+ csv.Context.RegisterClassMap<FooMap>();
+
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal("Bar", records[0].Name);
+ }
+ }
+
+ [Fact]
+ public void WriteRecords_WithParameterMap_DoesntUseParameterMaps()
+ {
+ var records = new List<Foo>
+ {
+ new Foo(1, "one"),
+ };
+
+ using (var writer = new StringWriter())
+ using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+ {
+ csv.Context.RegisterClassMap<FooMap>();
+
+ csv.WriteRecords(records);
+
+ var expected = new StringBuilder();
+ expected.Append("Id,Name\r\n");
+ expected.Append("1,one\r\n");
+
+ Assert.Equal(expected.ToString(), writer.ToString());
+ }
+ }
+
+ private class Foo
+ {
+ public int Id { get; private set; }
+
+ public string Name { get; private set; }
+
+ public Foo(int id, string name)
+ {
+ Id = id;
+ Name = name;
+ }
+ }
+
+ private class FooMap : ClassMap<Foo>
+ {
+ public FooMap()
+ {
+ Map(m => m.Id);
+ Map(m => m.Name);
+ Parameter("id");
+ Parameter("name").TypeConverter<CustomConverter>();
+ }
+ }
+
+ private class CustomConverter : DefaultTypeConverter
+ {
+ public override object ConvertFromString(string text, IReaderRow row, MemberMapData memberMapData)
+ {
+ return "Bar";
+ }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/CsvClassMappingTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/CsvClassMappingTests.cs
new file mode 100644
index 0000000..dc10243
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/CsvClassMappingTests.cs
@@ -0,0 +1,239 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using System;
+using System.Globalization;
+using System.Linq;
+using CsvHelper.Configuration;
+using CsvHelper.TypeConversion;
+using Xunit;
+
+namespace CsvHelper.Tests
+{
+
+ public class CsvClassMappingTests
+ {
+ [Fact]
+ public void MapTest()
+ {
+ var map = new TestMappingDefaultClass();
+ //map.CreateMap();
+
+ Assert.Equal(3, map.MemberMaps.Count);
+
+ Assert.Equal(0, map.MemberMaps[0].Data.Names.Count);
+ Assert.Equal(0, map.MemberMaps[0].Data.Index);
+ Assert.Null(map.MemberMaps[0].Data.TypeConverter);
+
+ Assert.Equal(0, map.MemberMaps[1].Data.Names.Count);
+ Assert.Equal(1, map.MemberMaps[1].Data.Index);
+ Assert.Null(map.MemberMaps[1].Data.TypeConverter);
+
+ Assert.Equal(0, map.MemberMaps[2].Data.Names.Count);
+ Assert.Equal(2, map.MemberMaps[2].Data.Index);
+ Assert.Null(map.MemberMaps[2].Data.TypeConverter);
+ }
+
+ [Fact]
+ public void MapNameTest()
+ {
+ var map = new TestMappingNameClass();
+ //map.CreateMap();
+
+ Assert.Equal(3, map.MemberMaps.Count);
+
+ Assert.Equal("Guid Column", map.MemberMaps[0].Data.Names.FirstOrDefault());
+ Assert.Equal("Int Column", map.MemberMaps[1].Data.Names.FirstOrDefault());
+ Assert.Equal("String Column", map.MemberMaps[2].Data.Names.FirstOrDefault());
+ }
+
+ [Fact]
+ public void MapIndexTest()
+ {
+ var map = new TestMappingIndexClass();
+ //map.CreateMap();
+
+ Assert.Equal(3, map.MemberMaps.Count);
+
+ Assert.Equal(2, map.MemberMaps[0].Data.Index);
+ Assert.Equal(3, map.MemberMaps[1].Data.Index);
+ Assert.Equal(1, map.MemberMaps[2].Data.Index);
+ }
+
+ [Fact]
+ public void MapIgnoreTest()
+ {
+ var map = new TestMappingIgnoreClass();
+ //map.CreateMap();
+
+ Assert.Equal(3, map.MemberMaps.Count);
+
+ Assert.True(map.MemberMaps[0].Data.Ignore);
+ Assert.False(map.MemberMaps[1].Data.Ignore);
+ Assert.True(map.MemberMaps[2].Data.Ignore);
+ }
+
+ [Fact]
+ public void MapTypeConverterTest()
+ {
+ var map = new TestMappingTypeConverterClass();
+ //map.CreateMap();
+
+ Assert.Equal(3, map.MemberMaps.Count);
+
+ Assert.IsType<Int16Converter>(map.MemberMaps[0].Data.TypeConverter);
+ Assert.IsType<StringConverter>(map.MemberMaps[1].Data.TypeConverter);
+ Assert.IsType<Int64Converter>(map.MemberMaps[2].Data.TypeConverter);
+ }
+
+ [Fact]
+ public void MapMultipleNamesTest()
+ {
+ var map = new TestMappingMultipleNamesClass();
+ //map.CreateMap();
+
+ Assert.Equal(3, map.MemberMaps.Count);
+
+ Assert.Equal(3, map.MemberMaps[0].Data.Names.Count);
+ Assert.Equal(3, map.MemberMaps[1].Data.Names.Count);
+ Assert.Equal(3, map.MemberMaps[2].Data.Names.Count);
+
+ Assert.Equal("guid1", map.MemberMaps[0].Data.Names[0]);
+ Assert.Equal("guid2", map.MemberMaps[0].Data.Names[1]);
+ Assert.Equal("guid3", map.MemberMaps[0].Data.Names[2]);
+
+ Assert.Equal("int1", map.MemberMaps[1].Data.Names[0]);
+ Assert.Equal("int2", map.MemberMaps[1].Data.Names[1]);
+ Assert.Equal("int3", map.MemberMaps[1].Data.Names[2]);
+
+ Assert.Equal("string1", map.MemberMaps[2].Data.Names[0]);
+ Assert.Equal("string2", map.MemberMaps[2].Data.Names[1]);
+ Assert.Equal("string3", map.MemberMaps[2].Data.Names[2]);
+ }
+
+ [Fact]
+ public void MapMultipleTypesTest()
+ {
+ var config = new CsvHelper.Configuration.CsvConfiguration(CultureInfo.InvariantCulture);
+ var context = new CsvContext(config);
+ context.RegisterClassMap<AMap>();
+ context.RegisterClassMap<BMap>();
+
+ Assert.NotNull(context.Maps[typeof(A)]);
+ Assert.NotNull(context.Maps[typeof(B)]);
+ }
+
+ [Fact]
+ public void PropertyMapAccessTest()
+ {
+ var config = new CsvHelper.Configuration.CsvConfiguration(CultureInfo.InvariantCulture);
+ var context = new CsvContext(config);
+ context.RegisterClassMap<AMap>();
+ context.Maps.Find<A>().Map(m => m.AId).Ignore();
+
+ Assert.True(context.Maps[typeof(A)].MemberMaps[0].Data.Ignore);
+ }
+
+ private class A
+ {
+ public int AId { get; set; }
+ }
+
+ private sealed class AMap : ClassMap<A>
+ {
+ public AMap()
+ {
+ Map(m => m.AId);
+ }
+ }
+
+ private class B
+ {
+ public int BId { get; set; }
+ }
+
+ private sealed class BMap : ClassMap<B>
+ {
+ public BMap()
+ {
+ Map(m => m.BId);
+ }
+ }
+
+ private class TestClass
+ {
+ public string StringColumn { get; set; }
+ public int IntColumn { get; set; }
+ public Guid GuidColumn { get; set; }
+ public string NotUsedColumn { get; set; }
+
+ public TestClass() { }
+
+ public TestClass(string stringColumn)
+ {
+ StringColumn = stringColumn;
+ }
+ }
+
+ private sealed class TestMappingDefaultClass : ClassMap<TestClass>
+ {
+ public TestMappingDefaultClass()
+ {
+ Map(m => m.GuidColumn);
+ Map(m => m.IntColumn);
+ Map(m => m.StringColumn);
+ }
+ }
+
+ private sealed class TestMappingNameClass : ClassMap<TestClass>
+ {
+ public TestMappingNameClass()
+ {
+ Map(m => m.GuidColumn).Name("Guid Column");
+ Map(m => m.IntColumn).Name("Int Column");
+ Map(m => m.StringColumn).Name("String Column");
+ }
+ }
+
+ private sealed class TestMappingIndexClass : ClassMap<TestClass>
+ {
+ public TestMappingIndexClass()
+ {
+ Map(m => m.GuidColumn).Index(3);
+ Map(m => m.IntColumn).Index(2);
+ Map(m => m.StringColumn).Index(1);
+ }
+ }
+
+ private sealed class TestMappingIgnoreClass : ClassMap<TestClass>
+ {
+ public TestMappingIgnoreClass()
+ {
+ Map(m => m.GuidColumn).Ignore();
+ Map(m => m.IntColumn);
+ Map(m => m.StringColumn).Ignore();
+ }
+ }
+
+ private sealed class TestMappingTypeConverterClass : ClassMap<TestClass>
+ {
+ public TestMappingTypeConverterClass()
+ {
+ Map(m => m.GuidColumn).TypeConverter<Int16Converter>();
+ Map(m => m.IntColumn).TypeConverter<StringConverter>();
+ Map(m => m.StringColumn).TypeConverter(new Int64Converter());
+ }
+ }
+
+ private sealed class TestMappingMultipleNamesClass : ClassMap<TestClass>
+ {
+ public TestMappingMultipleNamesClass()
+ {
+ Map(m => m.GuidColumn).Name("guid1", "guid2", "guid3");
+ Map(m => m.IntColumn).Name("int1", "int2", "int3");
+ Map(m => m.StringColumn).Name("string1", "string2", "string3");
+ }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/FieldMappingTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/FieldMappingTests.cs
new file mode 100644
index 0000000..3d52839
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/FieldMappingTests.cs
@@ -0,0 +1,397 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Text;
+using CsvHelper.Configuration;
+using Xunit;
+#pragma warning disable 649
+
+namespace CsvHelper.Tests.Mappings
+{
+
+ public class FieldMappingTests
+ {
+ [Fact]
+ public void ReadPublicFieldsWithAutoMapTest()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture)
+ {
+ MemberTypes = MemberTypes.Fields,
+ };
+ using (var stream = new MemoryStream())
+ using (var writer = new StreamWriter(stream))
+ using (var reader = new StreamReader(stream))
+ using (var csv = new CsvReader(reader, config))
+ {
+ writer.WriteLine("IdField,NameField");
+ writer.WriteLine("1,one");
+ writer.Flush();
+ stream.Position = 0;
+
+ var records = csv.GetRecords<APublic>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].IdField);
+ Assert.Equal("one", records[0].BField.NameField);
+ }
+ }
+
+ [Fact]
+ public void WritePublicFieldsWithAutoMapTest()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture)
+ {
+ MemberTypes = MemberTypes.Fields,
+ };
+ using (var stream = new MemoryStream())
+ using (var writer = new StreamWriter(stream))
+ using (var reader = new StreamReader(stream))
+ using (var csv = new CsvWriter(writer, config))
+ {
+ var list = new List<APublic>
+ {
+ new APublic
+ {
+ IdField = 1,
+ BField = new BPublic
+ {
+ NameField = "one"
+ }
+ }
+ };
+ csv.WriteRecords(list);
+ writer.Flush();
+ stream.Position = 0;
+
+ var result = reader.ReadToEnd();
+
+ var expected = new TestStringBuilder(csv.Configuration.NewLine);
+ expected.AppendLine("IdField,NameField");
+ expected.AppendLine("1,one");
+
+ Assert.Equal(expected.ToString(), result);
+ }
+ }
+
+ [Fact]
+ public void ReadPublicFieldsWithMappingTest()
+ {
+ using (var stream = new MemoryStream())
+ using (var writer = new StreamWriter(stream))
+ using (var reader = new StreamReader(stream))
+ using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
+ {
+ writer.WriteLine("IdField,NameField");
+ writer.WriteLine("1,one");
+ writer.Flush();
+ stream.Position = 0;
+
+ csv.Context.RegisterClassMap<APublicMap>();
+ var records = csv.GetRecords<APublic>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].IdField);
+ Assert.Equal("one", records[0].BField.NameField);
+ }
+ }
+
+ [Fact]
+ public void WritePublicFieldsWithMappingTest()
+ {
+ using (var stream = new MemoryStream())
+ using (var writer = new StreamWriter(stream))
+ using (var reader = new StreamReader(stream))
+ using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+ {
+ var list = new List<APublic>
+ {
+ new APublic
+ {
+ IdField = 1,
+ BField = new BPublic
+ {
+ NameField = "one"
+ }
+ }
+ };
+ csv.Context.RegisterClassMap<APublicMap>();
+ csv.WriteRecords(list);
+ writer.Flush();
+ stream.Position = 0;
+
+ var result = reader.ReadToEnd();
+
+ var expected = new TestStringBuilder(csv.Configuration.NewLine);
+ expected.AppendLine("IdField,NameField");
+ expected.AppendLine("1,one");
+
+ Assert.Equal(expected.ToString(), result);
+ }
+ }
+
+ [Fact]
+ public void ReadPrivateFieldsWithAutoMapTest()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture)
+ {
+ MemberTypes = MemberTypes.Fields,
+ IncludePrivateMembers = true,
+ };
+ using (var stream = new MemoryStream())
+ using (var writer = new StreamWriter(stream))
+ using (var reader = new StreamReader(stream))
+ using (var csv = new CsvReader(reader, config))
+ {
+ writer.WriteLine("idField,nameField");
+ writer.WriteLine("1,one");
+ writer.Flush();
+ stream.Position = 0;
+
+ var records = csv.GetRecords<APrivate>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].GetId());
+ Assert.Equal("one", records[0].GetB().GetName());
+ }
+ }
+
+ [Fact]
+ public void WritePrivateFieldsWithAutoMapTest()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture)
+ {
+ MemberTypes = MemberTypes.Fields,
+ IncludePrivateMembers = true,
+ };
+ using (var stream = new MemoryStream())
+ using (var writer = new StreamWriter(stream))
+ using (var reader = new StreamReader(stream))
+ using (var csv = new CsvWriter(writer, config))
+ {
+ var list = new List<APrivate>
+ {
+ new APrivate( 1, "one" )
+ };
+
+ csv.WriteRecords(list);
+ writer.Flush();
+ stream.Position = 0;
+
+ var result = reader.ReadToEnd();
+
+ var expected = new TestStringBuilder(csv.Configuration.NewLine);
+ expected.AppendLine("idField,nameField");
+ expected.AppendLine("1,one");
+
+ Assert.Equal(expected.ToString(), result);
+ }
+ }
+
+ [Fact]
+ public void ReadPrivateFieldsWithMappingTest()
+ {
+ using (var stream = new MemoryStream())
+ using (var writer = new StreamWriter(stream))
+ using (var reader = new StreamReader(stream))
+ using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
+ {
+ writer.WriteLine("idField,nameField");
+ writer.WriteLine("1,one");
+ writer.Flush();
+ stream.Position = 0;
+
+ csv.Context.RegisterClassMap<APrivateMap>();
+ var records = csv.GetRecords<APrivate>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].GetId());
+ Assert.Equal("one", records[0].GetB().GetName());
+ }
+ }
+
+ [Fact]
+ public void WritePrivateFieldsWithMappingTest()
+ {
+ using (var stream = new MemoryStream())
+ using (var writer = new StreamWriter(stream))
+ using (var reader = new StreamReader(stream))
+ using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+ {
+ var list = new List<APrivate>
+ {
+ new APrivate( 1, "one" )
+ };
+ csv.Context.RegisterClassMap<APrivateMap>();
+ csv.WriteRecords(list);
+ writer.Flush();
+ stream.Position = 0;
+
+ var result = reader.ReadToEnd();
+
+ var expected = new TestStringBuilder(csv.Configuration.NewLine);
+ expected.AppendLine("idField,nameField");
+ expected.AppendLine("1,one");
+
+ Assert.Equal(expected.ToString(), result);
+ }
+ }
+
+ [Fact]
+ public void ReadPublicFieldsAndPropertiesWithAutoMapTest()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture)
+ {
+ MemberTypes = MemberTypes.Properties | MemberTypes.Fields,
+ };
+ using (var stream = new MemoryStream())
+ using (var writer = new StreamWriter(stream))
+ using (var reader = new StreamReader(stream))
+ using (var csv = new CsvReader(reader, config))
+ {
+ writer.WriteLine("IdField,NameField,IdProp,NameProp");
+ writer.WriteLine("1,one,2,two");
+ writer.Flush();
+ stream.Position = 0;
+
+ var records = csv.GetRecords<APublic>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].IdField);
+ Assert.Equal("one", records[0].BField.NameField);
+ }
+ }
+
+ [Fact]
+ public void WritePublicFieldsAndPropertiesWithAutoMapTest()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture)
+ {
+ MemberTypes = MemberTypes.Properties | MemberTypes.Fields,
+ };
+ using (var stream = new MemoryStream())
+ using (var writer = new StreamWriter(stream))
+ using (var reader = new StreamReader(stream))
+ using (var csv = new CsvWriter(writer, config))
+ {
+ var list = new List<APublic>
+ {
+ new APublic
+ {
+ IdField = 1,
+ BField = new BPublic
+ {
+ NameField = "one",
+ NameProp = "two"
+ },
+ IdProp = 2
+ }
+ };
+ csv.WriteRecords(list);
+ writer.Flush();
+ stream.Position = 0;
+
+ var result = reader.ReadToEnd();
+
+ var expected = new TestStringBuilder(csv.Configuration.NewLine);
+ expected.AppendLine("IdProp,IdField,NameProp,NameField");
+ expected.AppendLine("2,1,two,one");
+
+ Assert.Equal(expected.ToString(), result);
+ }
+ }
+
+ private class APublic
+ {
+ public int IdField;
+ public BPublic BField;
+
+ public int IdProp { get; set; }
+ }
+
+ private class BPublic
+ {
+ public string NameField;
+
+ public string NameProp { get; set; }
+ }
+
+ private sealed class APublicMap : ClassMap<APublic>
+ {
+ public APublicMap()
+ {
+ Map(m => m.IdField);
+ References<BPublicMap>(m => m.BField);
+ }
+ }
+
+ private sealed class BPublicMap : ClassMap<BPublic>
+ {
+ public BPublicMap()
+ {
+ Map(m => m.NameField);
+ }
+ }
+
+ private class APrivate
+ {
+ private int idField;
+ private BPrivate bField;
+
+ private int IdProp { get; set; }
+ private BPrivate BProp { get; set; }
+
+ public int GetId()
+ {
+ return idField;
+ }
+
+ public BPrivate GetB()
+ {
+ return bField;
+ }
+
+ public APrivate() { }
+
+ public APrivate(int id, string name)
+ {
+ this.idField = id;
+ bField = new BPrivate(name);
+ }
+ }
+
+ private class BPrivate
+ {
+ private string nameField;
+
+ public string GetName()
+ {
+ return nameField;
+ }
+
+ public BPrivate() { }
+
+ public BPrivate(string name)
+ {
+ this.nameField = name;
+ }
+ }
+
+ private sealed class APrivateMap : ClassMap<APrivate>
+ {
+ public APrivateMap()
+ {
+ var config = new CsvHelper.Configuration.CsvConfiguration(CultureInfo.InvariantCulture)
+ {
+ IncludePrivateMembers = true,
+ MemberTypes = MemberTypes.Fields
+ };
+ AutoMap(config);
+ }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/HiddenBaseMembersTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/HiddenBaseMembersTests.cs
new file mode 100644
index 0000000..518bcd4
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/HiddenBaseMembersTests.cs
@@ -0,0 +1,117 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using CsvHelper.Configuration;
+using CsvHelper.Tests.Mocks;
+using Xunit;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CsvHelper.Tests.Mappings
+{
+
+ public class HiddenBaseMembersTests
+ {
+ [Fact]
+ public void ReadWithAutoMapTest()
+ {
+ var parserMock = new ParserMock
+ {
+ { "Id" },
+ { "1" },
+ };
+ using (var csv = new CsvReader(parserMock))
+ {
+ var records = csv.GetRecords<Bar>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ }
+ }
+
+ [Fact]
+ public void ReadWithClassMapTest()
+ {
+ var parserMock = new ParserMock
+ {
+ { "Id" },
+ { "1" },
+ };
+ using (var csv = new CsvReader(parserMock))
+ {
+ csv.Context.RegisterClassMap<BarMap>();
+ var records = csv.GetRecords<Bar>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ }
+ }
+
+ [Fact]
+ public void WriteWithAutoMapTest()
+ {
+ var records = new List<Bar>
+ {
+ new Bar { Id = 1 },
+ };
+
+ using (var writer = new StringWriter())
+ using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+ {
+ csv.WriteRecords(records);
+
+ var expected = new TestStringBuilder(csv.Configuration.NewLine);
+ expected.AppendLine("Id");
+ expected.AppendLine("1");
+
+ Assert.Equal(expected.ToString(), writer.ToString());
+ }
+ }
+
+ [Fact]
+ public void WriteWithClassMapTest()
+ {
+ var records = new List<Bar>
+ {
+ new Bar { Id = 1 },
+ };
+
+ using (var writer = new StringWriter())
+ using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+ {
+ csv.Context.RegisterClassMap<BarMap>();
+ csv.WriteRecords(records);
+
+ var expected = new TestStringBuilder(csv.Configuration.NewLine);
+ expected.AppendLine("Id");
+ expected.AppendLine("1");
+
+ Assert.Equal(expected.ToString(), writer.ToString());
+ }
+ }
+
+ private abstract class Foo
+ {
+ public string Id { get; set; }
+ }
+
+ private class Bar : Foo
+ {
+ public new int Id { get; set; }
+ }
+
+ private class BarMap : ClassMap<Bar>
+ {
+ public BarMap()
+ {
+ Map(m => m.Id);
+ }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/IgnoreHeaderWhiteSpaceTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/IgnoreHeaderWhiteSpaceTests.cs
new file mode 100644
index 0000000..330ace9
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/IgnoreHeaderWhiteSpaceTests.cs
@@ -0,0 +1,52 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using CsvHelper.Configuration;
+using Xunit;
+
+namespace CsvHelper.Tests.Mappings
+{
+
+ public class IgnoreHeaderWhiteSpaceTests
+ {
+ [Fact]
+ public void Blah()
+ {
+ using (var stream = new MemoryStream())
+ using (var reader = new StreamReader(stream))
+ using (var writer = new StreamWriter(stream))
+ using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
+ {
+ writer.WriteLine("The Id,The Name");
+ writer.WriteLine("1,one");
+ writer.Flush();
+ stream.Position = 0;
+
+ csv.Context.RegisterClassMap<TestMap>();
+ var records = csv.GetRecords<Test>().ToList();
+
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal("one", records[0].Name);
+ }
+ }
+
+ private class Test
+ {
+ public int Id { get; set; }
+ public string Name { get; set; }
+ }
+
+ private sealed class TestMap : ClassMap<Test>
+ {
+ public TestMap()
+ {
+ Map(m => m.Id).Name("The Id");
+ Map(m => m.Name).Name("The Name");
+ }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/MapConstructorTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/MapConstructorTests.cs
new file mode 100644
index 0000000..4429f1d
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/MapConstructorTests.cs
@@ -0,0 +1,42 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using System;
+using System.Globalization;
+using System.IO;
+using CsvHelper.Configuration;
+using Xunit;
+
+namespace CsvHelper.Tests.Mappings
+{
+
+ public class MapConstructorTests
+ {
+ [Fact]
+ public void NoConstructor()
+ {
+ using (var stream = new MemoryStream())
+ using (var reader = new StreamReader(stream))
+ using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
+ {
+ Assert.Throws<MissingMethodException>(() => csv.Context.RegisterClassMap<TestMap>());
+ }
+ }
+
+ private class Test
+ {
+ public int Id { get; set; }
+ public string Name { get; set; }
+ }
+
+ private sealed class TestMap : ClassMap<Test>
+ {
+ private TestMap(string test)
+ {
+ Map(m => m.Id);
+ Map(m => m.Name);
+ }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/MappingWithNoHeaderTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/MappingWithNoHeaderTests.cs
new file mode 100644
index 0000000..0b97af6
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/MappingWithNoHeaderTests.cs
@@ -0,0 +1,243 @@
+using CsvHelper.Configuration;
+using CsvHelper.Configuration.Attributes;
+using CsvHelper.Tests.Mocks;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace CsvHelper.Tests.Mappings
+{
+ public class MappingWithNoHeaderTests
+ {
+ [Fact]
+ public void Read_NoHeader_HasNameAttribute_Reads()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture)
+ {
+ HasHeaderRecord = false,
+ };
+ var parser = new ParserMock(config)
+ {
+ { "1", "one" }
+ };
+
+ using (var csv = new CsvReader(parser))
+ {
+ var records = csv.GetRecords<FooAttribute>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal("one", records[0].Name);
+ }
+ }
+
+ [Fact]
+ public void Read_NoHeader_HasNameMap_Reads()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture)
+ {
+ HasHeaderRecord = false,
+ };
+ var parser = new ParserMock(config)
+ {
+ { "1", "one" }
+ };
+
+ using (var csv = new CsvReader(parser))
+ {
+ csv.Context.RegisterClassMap<FooMap>();
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal("one", records[0].Name);
+ }
+ }
+
+ [Fact]
+ public void Read_NoHeader_HasParameterAttribute_Reads()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture)
+ {
+ HasHeaderRecord = false,
+ };
+ var parser = new ParserMock(config)
+ {
+ { "1", "one" }
+ };
+
+ using (var csv = new CsvReader(parser))
+ {
+ var records = csv.GetRecords<FooParameterAttribute>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal("one", records[0].Name);
+ }
+ }
+
+ [Fact]
+ public void Read_NoHeader_HasParameterMap_Reads()
+ {
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture)
+ {
+ HasHeaderRecord = false,
+ };
+ var parser = new ParserMock(config)
+ {
+ { "1", "one" }
+ };
+
+ using (var csv = new CsvReader(parser))
+ {
+ csv.Context.RegisterClassMap<FooParameterMap>();
+ var records = csv.GetRecords<FooParameter>().ToList();
+
+ Assert.Single(records);
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal("one", records[0].Name);
+ }
+ }
+
+ [Fact]
+ public void Write_HasHeader_HasNameAttribute_Writes()
+ {
+ var records = new List<FooAttribute>
+ {
+ new FooAttribute { Id = 1, Name = "one" },
+ };
+
+ var writer = new StringWriter();
+ using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+ {
+ csv.WriteRecords(records);
+
+ var expected = "New Id,New Name\r\n1,one\r\n";
+ Assert.Equal(expected, writer.ToString());
+ }
+ }
+
+ [Fact]
+ public void Write_HasHeader_HasNameMap_Writes()
+ {
+ var records = new List<Foo>
+ {
+ new Foo { Id = 1, Name = "one" },
+ };
+
+ var writer = new StringWriter();
+ using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+ {
+ csv.Context.RegisterClassMap<FooMap>();
+ csv.WriteRecords(records);
+
+ var expected = "New Id,New Name\r\n1,one\r\n";
+ Assert.Equal(expected, writer.ToString());
+ }
+ }
+
+ [Fact]
+ public void Write_HasHeader_HasParameterAttribute_Writes()
+ {
+ var records = new List<FooParameterAttribute>
+ {
+ new FooParameterAttribute(1, "one"),
+ };
+
+ var writer = new StringWriter();
+ using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+ {
+ csv.WriteRecords(records);
+
+ var expected = "Id,Name\r\n1,one\r\n";
+ Assert.Equal(expected, writer.ToString());
+ }
+ }
+
+ [Fact]
+ public void Write_HasHeader_HasParameterMap_Writes()
+ {
+ var records = new List<FooParameterAttribute>
+ {
+ new FooParameterAttribute(1, "one"),
+ };
+
+ var writer = new StringWriter();
+ using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+ {
+ csv.Context.RegisterClassMap<FooParameterMap>();
+ csv.WriteRecords(records);
+
+ var expected = "Id,Name\r\n1,one\r\n";
+ Assert.Equal(expected, writer.ToString());
+ }
+ }
+
+ private class FooAttribute
+ {
+ [Index(0)]
+ [Name("New Id")]
+ public int Id { get; set; }
+
+ [Index(1)]
+ [Name("New Name")]
+ public string Name { get; set; }
+ }
+
+ private class Foo
+ {
+ public int Id { get; set; }
+
+ public string Name { get; set; }
+ }
+
+ private class FooMap : ClassMap<Foo>
+ {
+ public FooMap()
+ {
+ Map(x => x.Id).Name("New Id").Index(0);
+ Map(x => x.Name).Name("New Name").Index(1);
+ }
+ }
+
+ private class FooParameterAttribute
+ {
+ public int Id { get; private set; }
+
+ public string Name { get; private set; }
+
+ public FooParameterAttribute([Name("New Id")]int id, [Name("New Name")]string name)
+ {
+ Id = id;
+ Name = name;
+ }
+ }
+
+ private class FooParameter
+ {
+ public int Id { get; private set; }
+
+ public string Name { get; private set; }
+
+ public FooParameter(int id, string name)
+ {
+ Id = id;
+ Name = name;
+ }
+ }
+
+ private class FooParameterMap : ClassMap<FooParameter>
+ {
+ public FooParameterMap()
+ {
+ Parameter("id").Name("New Id").Index(0);
+ Parameter("name").Name("New Name").Index(1);
+ }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/OptionalTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/OptionalTests.cs
new file mode 100644
index 0000000..66ea742
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/OptionalTests.cs
@@ -0,0 +1,220 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using CsvHelper.Tests.Mocks;
+using Xunit;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using CsvHelper;
+using CsvHelper.Configuration;
+
+namespace CsvHelper.Tests.Mappings
+{
+
+ public class OptionalTests
+ {
+ [Fact]
+ public void OptionalWithExistingColumnTest()
+ {
+ var parserMock = new ParserMock
+ {
+ { "Id", "Name" },
+ { "1", "one" },
+ { "2", "two" },
+ };
+
+ var csvReader = new CsvReader(parserMock);
+ csvReader.Context.RegisterClassMap<FooOptionalIntMap>();
+
+ var records = csvReader.GetRecords<Foo>().ToList();
+
+ Assert.NotNull(records);
+ Assert.Equal(2, records.Count);
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal("one", records[0].Name);
+ Assert.Equal(2, records[1].Id);
+ Assert.Equal("two", records[1].Name);
+ }
+
+ [Fact]
+ public void OptionalIntTest()
+ {
+ var parserMock = new ParserMock
+ {
+ { "Name" },
+ { "one" },
+ { "two" },
+ };
+
+ var csvReader = new CsvReader(parserMock);
+ csvReader.Context.RegisterClassMap<FooOptionalIntMap>();
+
+ var records = csvReader.GetRecords<Foo>().ToList();
+
+ Assert.NotNull(records);
+ Assert.Equal(2, records.Count);
+
+ Assert.Equal(0, records[0].Id);
+ Assert.Equal("one", records[0].Name);
+
+ Assert.Equal(0, records[1].Id);
+ Assert.Equal("two", records[1].Name);
+ }
+
+ [Fact]
+ public void OptionalIntDefaultTest()
+ {
+ var parserMock = new ParserMock
+ {
+ { "Name" },
+ { "one" },
+ { "two" },
+ };
+
+ var csvReader = new CsvReader(parserMock);
+ csvReader.Context.RegisterClassMap<FooOptionalIntDefaultMap>();
+
+ var records = csvReader.GetRecords<Foo>().ToList();
+
+ Assert.NotNull(records);
+ Assert.Equal(2, records.Count);
+
+ Assert.Equal(int.MinValue, records[0].Id);
+ Assert.Equal("one", records[0].Name);
+
+ Assert.Equal(int.MinValue, records[1].Id);
+ Assert.Equal("two", records[1].Name);
+ }
+
+ [Fact]
+ public void OptionalStringIntDefaultTest()
+ {
+ var parserMock = new ParserMock
+ {
+ { "Name" },
+ { "one" },
+ { "two" },
+ };
+
+ var csvReader = new CsvReader(parserMock);
+ csvReader.Context.RegisterClassMap<FooOptionalStringIntDefaultMap>();
+
+ var records = csvReader.GetRecords<Foo>().ToList();
+
+ Assert.NotNull(records);
+ Assert.Equal(2, records.Count);
+
+ Assert.Equal(int.MinValue, records[0].Id);
+ Assert.Equal("one", records[0].Name);
+
+ Assert.Equal(int.MinValue, records[1].Id);
+ Assert.Equal("two", records[1].Name);
+ }
+
+ [Fact]
+ public void OptionalStringTest()
+ {
+ var parserMock = new ParserMock
+ {
+ { "Id" },
+ { "1" },
+ { "2" },
+ };
+
+ var csvReader = new CsvReader(parserMock);
+ csvReader.Context.RegisterClassMap<FooOptionalStringMap>();
+
+ var records = csvReader.GetRecords<Foo>().ToList();
+
+ Assert.NotNull(records);
+ Assert.Equal(2, records.Count);
+
+ Assert.Equal(1, records[0].Id);
+ Assert.Null(records[0].Name);
+
+ Assert.Equal(2, records[1].Id);
+ Assert.Null(records[1].Name);
+ }
+
+ [Fact]
+ public void OptionalStringDefaultTest()
+ {
+ var parserMock = new ParserMock
+ {
+ { "Id" },
+ { "1" },
+ { "2" },
+ };
+
+ var csvReader = new CsvReader(parserMock);
+ csvReader.Context.RegisterClassMap<FooOptionalStringDefaultMap>();
+
+ var records = csvReader.GetRecords<Foo>().ToList();
+
+ Assert.NotNull(records);
+ Assert.Equal(2, records.Count);
+
+ Assert.Equal(1, records[0].Id);
+ Assert.Equal("bar", records[0].Name);
+
+ Assert.Equal(2, records[1].Id);
+ Assert.Equal("bar", records[1].Name);
+ }
+
+ private class Foo
+ {
+ public int Id { get; set; }
+
+ public string Name { get; set; }
+ }
+
+ private sealed class FooOptionalIntMap : ClassMap<Foo>
+ {
+ public FooOptionalIntMap()
+ {
+ Map(m => m.Id).Optional();
+ Map(m => m.Name);
+ }
+ }
+
+ private sealed class FooOptionalIntDefaultMap : ClassMap<Foo>
+ {
+ public FooOptionalIntDefaultMap()
+ {
+ Map(m => m.Id).Optional().Default(int.MinValue);
+ Map(m => m.Name);
+ }
+ }
+
+ private sealed class FooOptionalStringIntDefaultMap : ClassMap<Foo>
+ {
+ public FooOptionalStringIntDefaultMap()
+ {
+ Map(m => m.Id).Optional().Default(int.MinValue.ToString());
+ Map(m => m.Name);
+ }
+ }
+
+ private sealed class FooOptionalStringMap : ClassMap<Foo>
+ {
+ public FooOptionalStringMap()
+ {
+ Map(m => m.Id);
+ Map(m => m.Name).Optional();
+ }
+ }
+
+ private sealed class FooOptionalStringDefaultMap : ClassMap<Foo>
+ {
+ public FooOptionalStringDefaultMap()
+ {
+ Map(m => m.Id);
+ Map(m => m.Name).Optional().Default("bar");
+ }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Property/ConstantTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Property/ConstantTests.cs
new file mode 100644
index 0000000..9aab105
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/Property/ConstantTests.cs
@@ -0,0 +1,74 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using CsvHelper.Configuration;
+using Xunit;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CsvHelper.Tests.Mappings.Property
+{
+
+ public class ConstantTests
+ {
+ [Fact]
+ public void GetRecords_ConstantSet_FieldExists_ReturnsRecordsWithConstant()
+ {
+ var s = new StringBuilder();
+ s.Append("Id,Name\r\n");
+ s.Append("1,one\r\n");
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture)
+ {
+ };
+ using (var reader = new StringReader(s.ToString()))
+ using (var csv = new CsvReader(reader, config))
+ {
+ csv.Context.RegisterClassMap<FooMap>();
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Equal("Bar", records[0].Name);
+ }
+ }
+
+ [Fact]
+ public void GetRecords_ConstantSet_FieldMissing_ReturnsRecordsWithConstant()
+ {
+ var s = new StringBuilder();
+ s.Append("Id\r\n");
+ s.Append("1\r\n");
+ var config = new CsvConfiguration(CultureInfo.InvariantCulture)
+ {
+ };
+ using (var reader = new StringReader(s.ToString()))
+ using (var csv = new CsvReader(reader, config))
+ {
+ csv.Context.RegisterClassMap<FooMap>();
+ var records = csv.GetRecords<Foo>().ToList();
+
+ Assert.Equal("Bar", records[0].Name);
+ }
+ }
+
+ private class Foo
+ {
+ public string Id { get; set; }
+
+ public string Name { get; set; }
+ }
+
+ private class FooMap : ClassMap<Foo>
+ {
+ public FooMap()
+ {
+ Map(m => m.Id).Index(0);
+ Map(m => m.Name).Index(1).Constant("Bar");
+ }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ReferenceConstructorArgsTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ReferenceConstructorArgsTests.cs
new file mode 100644
index 0000000..6bd33f7
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/ReferenceConstructorArgsTests.cs
@@ -0,0 +1,50 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using CsvHelper.Configuration;
+using Xunit;
+
+namespace CsvHelper.Tests.Mappings
+{
+
+ public class ReferenceConstructorArgsTests
+ {
+ [Fact]
+ public void Test()
+ {
+ var map = new AMap( "A Field" );
+ var name = map.ReferenceMaps[0].Data.Mapping.MemberMaps.Find<B>( m => m.Name ).Data.Names[0];
+ Assert.Equal( "B Field", name );
+ }
+
+ private class A
+ {
+ public string Name { get; set; }
+
+ public B B { get; set; }
+ }
+
+ private class B
+ {
+ public string Name { get; set; }
+ }
+
+ private sealed class AMap : ClassMap<A>
+ {
+ public AMap( string name )
+ {
+ Map( m => m.Name ).Name( name );
+ References<BMap>( m => m.B, "B Field" );
+ }
+ }
+
+ private sealed class BMap : ClassMap<B>
+ {
+ public BMap( string name )
+ {
+ Map( m => m.Name ).Name( name );
+ }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/RuntimeMapping.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/RuntimeMapping.cs
new file mode 100644
index 0000000..41f0714
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/RuntimeMapping.cs
@@ -0,0 +1,199 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using CsvHelper.Configuration;
+using System;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using Xunit;
+
+namespace CsvHelper.Tests.Mappings
+{
+
+ public class RuntimeMapping
+ {
+ [Fact]
+ public void ConstantTest()
+ {
+ using (var stream = new MemoryStream())
+ using (var writer = new StreamWriter(stream))
+ using (var reader = new StreamReader(stream))
+ using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
+ {
+ writer.WriteLine("AId,BId,CId");
+ writer.WriteLine("1,2,3");
+ writer.Flush();
+ stream.Position = 0;
+
+ var map = new DefaultClassMap<A>();
+ var type = typeof(A);
+ var member = type.GetProperty("AId");
+ map.Map(type, member).Constant(4);
+
+ csv.Context.RegisterClassMap(map);
+ var records = csv.GetRecords<A>().ToList();
+
+ Assert.Equal(4, records[0].AId);
+ }
+ }
+
+ [Fact]
+ public void DefaultTest()
+ {
+ using (var stream = new MemoryStream())
+ using (var writer = new StreamWriter(stream))
+ using (var reader = new StreamReader(stream))
+ using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
+ {
+ writer.WriteLine("AId,BId,CId");
+ writer.WriteLine(",2,3");
+ writer.Flush();
+ stream.Position = 0;
+
+ var map = new DefaultClassMap<A>();
+ var type = typeof(A);
+ var member = type.GetProperty("AId");
+ map.Map(type, member).Default(4);
+
+ csv.Context.RegisterClassMap(map);
+ var records = csv.GetRecords<A>().ToList();
+
+ Assert.Equal(4, records[0].AId);
+ }
+ }
+
+ [Fact]
+ public void ConstantNullableTest()
+ {
+ using (var stream = new MemoryStream())
+ using (var writer = new StreamWriter(stream))
+ using (var reader = new StreamReader(stream))
+ using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
+ {
+ writer.WriteLine("AId,BId,CId,NullableNum");
+ writer.WriteLine("1,2,3,1");
+ writer.Flush();
+ stream.Position = 0;
+
+ var map = new DefaultClassMap<A>();
+ var type = typeof(A);
+ var member = type.GetProperty("NullableNum");
+ map.Map(type, member).Constant(4);
+
+ csv.Context.RegisterClassMap(map);
+ var records = csv.GetRecords<A>().ToList();
+
+ Assert.Equal(4, records[0].NullableNum);
+ }
+ }
+
+ [Fact]
+ public void DefaultNullableTest()
+ {
+ using (var stream = new MemoryStream())
+ using (var writer = new StreamWriter(stream))
+ using (var reader = new StreamReader(stream))
+ using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
+ {
+ writer.WriteLine("AId,BId,CId,NullableNum");
+ writer.WriteLine("1,2,3,");
+ writer.Flush();
+ stream.Position = 0;
+
+ var map = new DefaultClassMap<A>();
+ var type = typeof(A);
+ var member = type.GetProperty("NullableNum");
+ map.Map(type, member).Default(4);
+
+ csv.Context.RegisterClassMap(map);
+ var records = csv.GetRecords<A>().ToList();
+
+ Assert.Equal(4, records[0].NullableNum);
+ }
+ }
+
+ [Fact]
+ public void ConstantValueTypeNullTest()
+ {
+ Assert.Throws<ArgumentException>(() => new ConstantValueTypeNullMap());
+ }
+
+ [Fact]
+ public void ConstantTypeMismatchTest()
+ {
+ Assert.Throws<ArgumentException>(() => new ConstantTypeMismatchMap());
+ }
+
+ [Fact]
+ public void DefaultValueTypeNullTest()
+ {
+ Assert.Throws<ArgumentException>(() => new DefaultValueTypeNullMap());
+ }
+
+ [Fact]
+ public void DefaultTypeMismatchTest()
+ {
+ Assert.Throws<ArgumentException>(() => new DefaultTypeMismatchMap());
+ }
+
+ private class A
+ {
+ public int AId { get; set; }
+
+ public int? NullableNum { get; set; }
+
+ public B B { get; set; }
+ }
+
+ private class B
+ {
+ public int BId { get; set; }
+
+ public C C { get; set; }
+ }
+
+ private class C
+ {
+ public int CId { get; set; }
+ }
+
+ private class ObjectProperty
+ {
+ public object O { get; set; }
+ }
+
+ private class ConstantValueTypeNullMap : ClassMap<A>
+ {
+ public ConstantValueTypeNullMap()
+ {
+ Map(m => m.AId).Constant(null);
+ }
+ }
+
+ private class ConstantTypeMismatchMap : ClassMap<A>
+ {
+ public ConstantTypeMismatchMap()
+ {
+ Map(m => m.AId).Constant((uint)1);
+ }
+ }
+
+ private class DefaultValueTypeNullMap : ClassMap<A>
+ {
+ public DefaultValueTypeNullMap()
+ {
+ Map(m => m.AId).Constant(null);
+ }
+ }
+
+ private class DefaultTypeMismatchMap : ClassMap<A>
+ {
+ public DefaultTypeMismatchMap()
+ {
+ Map(m => m.AId).Constant((uint)1);
+ }
+ }
+ }
+}
diff --git a/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/SubPropertyMappingTests.cs b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/SubPropertyMappingTests.cs
new file mode 100644
index 0000000..d1c3f8c
--- /dev/null
+++ b/ThirdParty/CsvHelper-master/tests/CsvHelper.Tests/Mappings/SubPropertyMappingTests.cs
@@ -0,0 +1,127 @@
+// Copyright 2009-2022 Josh Close
+// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
+// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
+// https://github.com/JoshClose/CsvHelper
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using CsvHelper.Configuration;
+using Xunit;
+
+namespace CsvHelper.Tests.Mappings
+{
+
+ public class SubPropertyMappingTests
+ {
+ [Fact]
+ public void ReadTest()
+ {
+ using (var stream = new MemoryStream())
+ using (var reader = new StreamReader(stream))
+ using (var writer = new StreamWriter(stream))
+ using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
+ {
+ writer.WriteLine("P3,P1,P2");
+ writer.WriteLine("p3,p1,p2");
+ writer.Flush();
+ stream.Position = 0;
+
+ csv.Context.RegisterClassMap<AMap>();
+ var records = csv.GetRecords<A>().ToList();
+
+ Assert.Equal("p1", records[0].P1);
+ Assert.Equal("p2", records[0].B.P2);
+ Assert.Equal("p3", records[0].B.C.P3);
+ }
+ }
+
+ [Fact]
+ public void WriteTest()
+ {
+ using (var stream = new MemoryStream())
+ using (var reader = new StreamReader(stream))
+ using (var writer = new StreamWriter(stream))
+ using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
+ {
+ var list = new List<A>()
+ {
+ new A
+ {
+ P1 = "p1",
+ B = new B
+ {
+ P2 = "p2",
+ C = new C
+ {
+ P3 = "p3"
+ }
+ }
+ }
+ };
+
+ csv.Context.RegisterClassMap<AMap>();
+ csv.WriteRecords(list);
+ writer.Flush();
+ stream.Position = 0;
+
+ var expected = "P3,P1,P2\r\n";
+ expected += "p3,p1,p2\r\n";
+ var result = reader.ReadToEnd();
+
+ Assert.Equal(expected, result);
+ }
+ }
+
+ [Fact]
+ public void ChangeMemberMapTest()
+ {
+ var config = new CsvHelper.Configuration.CsvConfiguration(CultureInfo.InvariantCulture);
+ var context = new CsvContext(config);
+ var map = context.AutoMap<A>();
+ map.Map(m => m.B.C.P3).Index(3);
+ }
+
+ [Fact]
+ public void AutoMapInClassMapTest()
+ {
+ var map = new AAutoMap();
+ }
+
+ private class A
+ {
+ public string P1 { get; set; }
+ public B B { get; set; }
+ }
+
+ private class B
+ {
+ public string P2 { get; set; }
+ public C C { get; set; }
+ }
+
+ private class C
+ {
+ public string P3 { get; set; }
+ }
+
+ private sealed class AMap : ClassMap<A>
+ {
+ public AMap()
+ {
+ Map(m => m.B.C.P3).Index(0);
+ Map(m => m.P1).Index(1);
+ Map(m => m.B.P2).Index(2);
+ }
+ }
+
+ private sealed class AAutoMap : ClassMap<A>
+ {
+ public AAutoMap()
+ {
+ AutoMap(CultureInfo.InvariantCulture);
+ Map(m => m.B.C.P3).Index(3);
+ }
+ }
+ }
+}