Skip to content
This repository was archived by the owner on Jun 22, 2025. It is now read-only.

Commit b5d7f03

Browse files
authored
Tests: Validation of server version/featureset (#420)
1 parent e730c9c commit b5d7f03

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

ClickHouse.Client.Tests/TestUtilities.cs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System.Linq;
55
using System.Net;
66
using System.Numerics;
7+
using System.Threading.Tasks;
78
using ClickHouse.Client.ADO;
89
using ClickHouse.Client.Numerics;
910
using ClickHouse.Client.Utility;
@@ -31,6 +32,14 @@ static TestUtilities()
3132
}
3233
}
3334

35+
[Test]
36+
public static async Task ExpectedFeaturesShouldMatchActualFeatures()
37+
{
38+
using var connection = GetTestClickHouseConnection();
39+
await connection.OpenAsync();
40+
Assert.AreEqual(SupportedFeatures & connection.SupportedFeatures, connection.SupportedFeatures);
41+
}
42+
3443
/// <summary>
3544
/// Utility method to allow to redirect ClickHouse connections to different machine, in case of Windows development environment
3645
/// </summary>
@@ -134,12 +143,9 @@ public static IEnumerable<DataTypeSample> GetDataTypeSamples()
134143
yield return new DataTypeSample("DateTime('UTC')", typeof(DateTime), "toDateTime('1988-08-28 11:22:33', 'UTC')", new DateTime(1988, 08, 28, 11, 22, 33, DateTimeKind.Unspecified));
135144
yield return new DataTypeSample("DateTime('Pacific/Fiji')", typeof(DateTime), "toDateTime('1999-01-01 13:00:00', 'Pacific/Fiji')", new DateTime(1999, 01, 01, 13, 00, 00, DateTimeKind.Unspecified));
136145

137-
if (SupportedFeatures.HasFlag(Feature.DateTime64))
138-
{
139-
yield return new DataTypeSample("DateTime64(4, 'UTC')", typeof(DateTime), "toDateTime64('2043-03-01 18:34:04.4444', 9, 'UTC')", new DateTime(644444444444444000, DateTimeKind.Utc));
140-
yield return new DataTypeSample("DateTime64(7, 'UTC')", typeof(DateTime), "toDateTime64('2043-03-01 18:34:04.4444444', 9, 'UTC')", new DateTime(644444444444444444, DateTimeKind.Utc));
141-
yield return new DataTypeSample("DateTime64(7, 'Pacific/Fiji')", typeof(DateTime), "toDateTime64('2043-03-01 18:34:04.4444444', 9, 'Pacific/Fiji')", new DateTime(644444444444444444, DateTimeKind.Unspecified));
142-
}
146+
yield return new DataTypeSample("DateTime64(4, 'UTC')", typeof(DateTime), "toDateTime64('2043-03-01 18:34:04.4444', 9, 'UTC')", new DateTime(644444444444444000, DateTimeKind.Utc));
147+
yield return new DataTypeSample("DateTime64(7, 'UTC')", typeof(DateTime), "toDateTime64('2043-03-01 18:34:04.4444444', 9, 'UTC')", new DateTime(644444444444444444, DateTimeKind.Utc));
148+
yield return new DataTypeSample("DateTime64(7, 'Pacific/Fiji')", typeof(DateTime), "toDateTime64('2043-03-01 18:34:04.4444444', 9, 'Pacific/Fiji')", new DateTime(644444444444444444, DateTimeKind.Unspecified));
143149

144150
if (SupportedFeatures.HasFlag(Feature.Decimals))
145151
{

0 commit comments

Comments
 (0)