Esempio n. 1
0
        public void Test_JsonMirror()
        {
            string domain  = "https://api.limeade.cloud";
            string path    = "/api/diagnostic/healthcheck?q=true";
            var    client  = new MirrorClient(domain);
            var    resp    = client.GetAsync(path);
            var    storage = new BlobStorage(domain);
            var    cached  = storage.Get(path);

            Assert.IsNotNull(cached);
        }
Esempio n. 2
0
    public static async Task <TopicMessage[]> CaptureOrTimeoutAsync(MirrorClient mirror, Address topic, int expectedCount, int timeoutInMiliseconds)
    {
        using var cts = new CancellationTokenSource();
        var capture       = new TopicMessageCapture(expectedCount);
        var subscribeTask = mirror.SubscribeTopicAsync(new SubscribeTopicParams
        {
            Topic             = topic,
            Starting          = DateTime.UtcNow.AddHours(-1),
            MessageWriter     = capture,
            CancellationToken = cts.Token
        });

        cts.CancelAfter(timeoutInMiliseconds);
        await subscribeTask;

        return(capture.CapturedList.ToArray());
    }