Skip to content

Commit

Permalink
chore: add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bednar committed Sep 21, 2023
1 parent 7dd9615 commit 3e9a820
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions .markdownlint.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"MD013": false,
"MD024": false,
"MD033": {
"allowed_elements": [ "a", "img", "p" ]
},
Expand Down
18 changes: 17 additions & 1 deletion Client.Test/Write/PointDataTest.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.Numerics;
using InfluxDB3.Client.Write;

namespace InfluxDB3.Client.Test.Write
Expand Down Expand Up @@ -101,6 +103,7 @@ public void OverrideTagField()
}

[Test]
[SuppressMessage("ReSharper", "RedundantCast")]
public void FieldTypes()
{
var point = PointData.Measurement("h2o").SetTag("location", "europe")
Expand All @@ -109,7 +112,6 @@ public void FieldTypes()
.SetField("float", 35.0F)
.SetField("integer", 7)
.SetField("short", (short)8)
// ReSharper disable once RedundantCast
.SetField("byte", (byte)9)
.SetField("ulong", (ulong)10)
.SetUintegerField("uint", (uint)11)
Expand Down Expand Up @@ -392,6 +394,20 @@ public void UseGenericObjectAsFieldValue()

Assert.That(point.ToLineProtocol(), Is.EqualTo("h2o,location=europe custom-object=\"test-10\""));
}

[Test]
public void GetMeasurementTagFieldTimestamp()
{
var point = PointData.Measurement("h2o")
.SetTag("location", "europe")
.SetField("a", 1)
.SetTimestamp(123L);

Assert.That(point.GetMeasurement(), Is.EqualTo("h2o"));
Assert.That(point.GetTag("location"), Is.EqualTo("europe"));
Assert.That(point.GetField("a"), Is.EqualTo(1));
Assert.That(point.GetTimestamp(), Is.EqualTo(new BigInteger(123)));
}
}

internal class GenericObject
Expand Down

0 comments on commit 3e9a820

Please sign in to comment.