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