Exemplo n.º 1
0
        public async Task<IInfluxDbApiResponse> Write(WriteRequest writeRequest)
        {
            var requestContent = new StringContent(writeRequest.GetLines(), Encoding.UTF8, "text/plain");
            var requestParams = RequestClientUtility.BuildRequestParams(writeRequest.DbName, QueryParams.Precision, writeRequest.Precision);
            var result = await this.RequestClient.PostDataAsync(requestParams: requestParams, content: requestContent);

            return new InfluxDbApiWriteResponse(result.StatusCode, result.Body);
        }
Exemplo n.º 2
0
        public void WriteRequest_OnGetLines_ShouldReturnNewLineSeparatedPoints()
        {
            var points = _fixture.CreateMockPoints(2);
            var formatter = _fixture.Sut.GetFormatter();
            var request = new WriteRequest(formatter)
            {
                Points = points
            };

            var actual = request.GetLines();
            var expected = String.Join("\n", points.Select(p => formatter.PointToString(p)));

            actual.Should().Be(expected);
        }