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);
        }
Exemple #2
0
 public KustoParameter(string name, object value, KustoDataType type)
 {
     Name  = name;
     Type  = type;
     Value = value;
 }