public async Task QueryRaw() { MockServer.Given(Request.Create().WithPath("/api/v2/query").UsingPost()) .RespondWith(CreateResponse()); var result = await FluxClient.QueryRaw("from(bucket:\"telegraf\")"); AssertSuccessResult(result); }
public async Task QueryRawCallbackOnError() { MockServer.Stop(); await FluxClient.QueryRaw("from(bucket:\"telegraf\")", (cancellable, result) => Assert.Fail("Unreachable"), error => CountdownEvent.Signal()); WaitToCallback(); }
public async Task QueryError() { MockServer.Given(Request.Create().WithPath("/api/v2/query").UsingPost()) .RespondWith(CreateErrorResponse("Flux query is not valid")); try { await FluxClient.QueryRaw("from(bucket:\"telegraf\")"); Assert.Fail(); } catch (InfluxException e) { Assert.That(e.Message.Equals("Flux query is not valid")); } }
public async Task QueryRawCallbackOnComplete() { CountdownEvent = new CountdownEvent(1); MockServer.Given(Request.Create().WithPath("/api/v2/query").UsingPost()) .RespondWith(CreateResponse()); var results = new List <string>(); await FluxClient.QueryRaw("from(bucket:\"telegraf\")", null, (cancellable, result) => results.Add(result), error => Assert.Fail("Unreachable"), () => CountdownEvent.Signal()); WaitToCallback(); AssertSuccessResult(string.Join("\n", results)); }
public async Task QueryRawCallback() { CountdownEvent = new CountdownEvent(8); MockServer.Given(Request.Create().WithPath("/api/v2/query").UsingPost()) .RespondWith(CreateResponse()); var results = new List <string>(); await FluxClient.QueryRaw("from(bucket:\"telegraf\")", (cancellable, result) => { results.Add(result); CountdownEvent.Signal(); }); WaitToCallback(); Assert.That(results.Count == 8); AssertSuccessResult(string.Join("\n", results)); }