-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: method DataTypeName returns the field type as defined in the so…
…urce (#96) * refactor: split CsvDataReader into sub-classes * feat: method DataTypeName returns the field type as defined in the source
- Loading branch information
Showing
9 changed files
with
440 additions
and
343 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using NUnit.Framework; | ||
using PocketCsvReader.Configuration; | ||
|
||
namespace PocketCsvReader.Testing; | ||
public class CsvRawRecordTest | ||
{ | ||
[Test] | ||
public void GetDataTypeName_WithIndexedSchema_CorrectNames() | ||
{ | ||
var schema = new SchemaDescriptorBuilder() | ||
.Indexed() | ||
.WithNumericField<decimal>((f) => f.WithDataSourceTypeName("number")) | ||
.WithField<string>((f) => f.WithDataSourceTypeName("string")) | ||
.Build(); | ||
var profile = new CsvProfile(new DialectDescriptor(), schema); | ||
var rawRecord = new CsvRawRecord(profile); | ||
Assert.That(rawRecord.GetDataTypeName(0), Is.EqualTo("number")); | ||
Assert.That(rawRecord.GetDataTypeName(1), Is.EqualTo("string")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.