示例#1
0
    public async Task Test_KustoTestEvent_StreamsToKusto()
    {
        KustoQueryClient.Should().NotBeNull();

        var bb = new BigBrother("", "");

        bb.UseKusto(KustoName, KustoLocation, KustoDatabase, KustoTenantId);

        var evt = new KustoTestEvent();

        bb.Publish(evt);

        await Policy.Handle <Exception>()
        .WaitAndRetryAsync(new[]
        {
            TimeSpan.FromSeconds(3),
            TimeSpan.FromSeconds(10),
            TimeSpan.FromSeconds(30)
        })
        .ExecuteAsync(async() =>
        {
            var reader = await KustoQueryClient.ExecuteQueryAsync(
                KustoDatabase,
                $"{nameof(KustoTestEvent)} | where {nameof(KustoTestEvent.Id)} == \"{evt.Id}\" | summarize count()",
                ClientRequestProperties.FromJsonString("{}"));

            reader.Read().Should().BeTrue();
            reader.GetInt64(0).Should().Be(1);
        });
    }