Skip to content

Commit

Permalink
Add (skipped) unittest for upcoming feature
Browse files Browse the repository at this point in the history
  • Loading branch information
jtellnes committed Feb 15, 2018
1 parent eda7b08 commit 313a4f4
Showing 1 changed file with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.IO;
using System;
using System.Text;
using Arkivverket.Arkade.Core.Addml;
using Arkivverket.Arkade.Core.Addml.Definitions;
Expand Down Expand Up @@ -105,5 +106,29 @@ private void RecordShouldMatch(Record record, int fieldIndex, string name, strin
record.Fields[fieldIndex].Value.Should().Be(value);
}

[Fact(Skip = "Test is for a not yet implemented feature")]
public void SemicolonsWithinQuotesAreNotInterpretedAsFieldDelimiters()
{
AddmlFlatFileDefinition addmlFlatFileDefinition = new AddmlFlatFileDefinitionBuilder()
.WithRecordSeparator("CRLF").WithFieldSeparator(";").Build();

AddmlRecordDefinition recordDefinition = new AddmlRecordDefinitionBuilder()
.WithAddmlFlatFileDefinition(addmlFlatFileDefinition).Build();

new AddmlFieldDefinitionBuilder().WithRecordDefinition(recordDefinition).Build();
new AddmlFieldDefinitionBuilder().WithRecordDefinition(recordDefinition).Build();
new AddmlFieldDefinitionBuilder().WithRecordDefinition(recordDefinition).Build();

const string csvData = "AA;\"B;B\";CC";

var streamReader = new StreamReader(new MemoryStream(Encoding.UTF8.GetBytes(csvData)));
var recordReader = new DelimiterFileFormatReader(new FlatFile(addmlFlatFileDefinition), streamReader);
var actionOfGettingCurrent = (Action) (() => ((Func<object>) (() => recordReader.Current))());

recordReader.MoveNext(); // AA;"B;B";CC

actionOfGettingCurrent.ShouldNotThrow<Exception>();
recordReader.Current?.Fields?.Count.Should().Be(3);
}
}
}

0 comments on commit 313a4f4

Please sign in to comment.