public void ParseEmptyFileWithCarriageReturnNewline() { var writer = new StringWriter(); string[][] values = CsvWriterExtensions.ParseCsvFile("\r\n"); values.Should().BeEmpty(); }
public void ParseEmptyValue() { string[][] values = CsvWriterExtensions.ParseCsvFile("\"\"\r\n"); values.Should().ContainSingle(); values[0].Should().ContainSingle(); values[0][0].Should().Be(""); }
public void ParseMultipleSingleFieldRecordsNewline() { string[][] values = CsvWriterExtensions.ParseCsvFile("a\nb\n"); values.Should().HaveCount(2); values[0].Should().Equal(new[] { "a" }); values[1].Should().Equal(new[] { "b" }); }
public void ParseQuotedField() { string[][] values = CsvWriterExtensions.ParseCsvFile("a,\"a \"\"quoted\"\" string \r\n newlines\",first\r\n"); values.Should().ContainSingle(); values[0].Should().Equal(new[] { "a", "a \"quoted\" string \r\n newlines", "first" }); }
public async Task BasicSend(object inputValue, KustoDataType dataType, string representation) { string saved = null; var ingest = new Mock <IKustoIngestClient>(); ingest.Setup(i => i.IngestFromStreamAsync( It.IsAny <Stream>(), It.IsAny <KustoIngestionProperties>(), It.IsAny <StreamSourceOptions>())) .Callback((Stream s, KustoIngestionProperties p, StreamSourceOptions o) => { saved = new StreamReader(s).ReadToEnd(); }) .Returns(Task.FromResult(Mock.Of <IKustoIngestionResult>())); await KustoHelpers.WriteDataToKustoInMemoryAsync(ingest.Object, "TEST-DATABASE", "TEST-TABLE", new NUnitLogger(), new[] { inputValue }, v => new[] { new KustoValue("columnName", v, dataType), } ); string[][] parsed = CsvWriterExtensions.ParseCsvFile(saved); parsed.Should().ContainSingle(); parsed[0].Should().ContainSingle(); parsed[0][0].Should().Be(representation); }
public void ParseSimpleSingleValue() { var writer = new StringWriter(); string[][] values = CsvWriterExtensions.ParseCsvFile("a\r\n"); values.Should().ContainSingle(); values[0].Should().ContainSingle(); values[0][0].Should().Be("a"); }
public void ParseMultipleFields() { string[][] values = CsvWriterExtensions.ParseCsvFile("a,1,,first\r\n"); values.Should().ContainSingle(); values[0].Should().Equal(new[] { "a", "1", "", "first" }); }
public void ParseEmptyFileWithNewline() { string[][] values = CsvWriterExtensions.ParseCsvFile("\n"); values.Should().BeEmpty(); }