Ejemplo n.º 1
0
 public async Task <TsdbSubmissionResponse> PushAsync <T>(DataPoint <T> dataPoint)
 {
     if (dataPoint == null)
     {
         throw new ArgumentNullException(ErrorMessages.DATA_POINT_NULL, nameof(dataPoint));
     }
     return(await TsdbServer.PublishDataAsync(dataPoint.AsByteArray()));
 }
        public void SerializeDataPoint()
        {
            var sampleDataPoint = File.ReadAllText("DataPointFixtures/DataPointSample.json", Encoding.UTF8);

            var dataPoint = new DataPoint <int>
            {
                Value     = 15,
                Metric    = "testMetric",
                Timestamp = new DateTime(2015, 12, 12, 0, 0, 0, DateTimeKind.Utc).ToRawEpoch(),
                Tags      = TagsCollection.New("testHost")
            };

            CollectionAssert.AreEqual(dataPoint.AsByteArray(), Encoding.UTF8.GetBytes(sampleDataPoint));
        }