From 3e9a820bfc9a7181d69fab682774fe6c5c570e7e Mon Sep 17 00:00:00 2001 From: Jakub Bednar Date: Thu, 21 Sep 2023 13:40:45 +0200 Subject: [PATCH] chore: add tests --- .markdownlint.yml | 1 + Client.Test/Write/PointDataTest.cs | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/.markdownlint.yml b/.markdownlint.yml index ce7479e..d2adbe3 100644 --- a/.markdownlint.yml +++ b/.markdownlint.yml @@ -1,5 +1,6 @@ { "MD013": false, + "MD024": false, "MD033": { "allowed_elements": [ "a", "img", "p" ] }, diff --git a/Client.Test/Write/PointDataTest.cs b/Client.Test/Write/PointDataTest.cs index 4fccac1..f28843b 100644 --- a/Client.Test/Write/PointDataTest.cs +++ b/Client.Test/Write/PointDataTest.cs @@ -1,4 +1,6 @@ using System; +using System.Diagnostics.CodeAnalysis; +using System.Numerics; using InfluxDB3.Client.Write; namespace InfluxDB3.Client.Test.Write @@ -101,6 +103,7 @@ public void OverrideTagField() } [Test] + [SuppressMessage("ReSharper", "RedundantCast")] public void FieldTypes() { var point = PointData.Measurement("h2o").SetTag("location", "europe") @@ -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) @@ -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