Skip to content

Commit 338e0d3

Browse files
committed
Update tests
1 parent f87a95a commit 338e0d3

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

DuckDB.NET.Test/ManagedAppenderTests.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ public void IntervalValues()
236236
[Fact]
237237
public void TemporalValues()
238238
{
239-
Command.CommandText = "CREATE TABLE managedAppenderTemporal(a Date, b TimeStamp, c TIMESTAMP_NS, d TIMESTAMP_MS, e TIMESTAMP_S, f TIMESTAMPTZ, g TIMETZ);";
239+
Command.CommandText = "CREATE TABLE managedAppenderTemporal(a Date, b TimeStamp, c TIMESTAMP_NS, d TIMESTAMP_MS, e TIMESTAMP_S, f TIMESTAMPTZ, g TIMETZ, h Time);";
240240
Command.ExecuteNonQuery();
241241

242242
var dates = Enumerable.Range(0, 20).Select(i => new DateTime(1900, 1, 1).AddDays(Random.Shared.Next(1, 50000)).AddSeconds(Random.Shared.Next(3600 * 2, 3600 * 24))).ToList();
@@ -246,14 +246,16 @@ public void TemporalValues()
246246
foreach (var value in dates)
247247
{
248248
appender.CreateRow()
249+
.AppendValue((DateOnly?)DateOnly.FromDateTime(value))
249250
.AppendValue(value).AppendValue(value)
250-
.AppendValue(value).AppendValue(value)
251-
.AppendValue(value).AppendValue(value).AppendValue(value.ToDateTimeOffset(TimeSpan.FromHours(1)))
251+
.AppendValue(value).AppendValue(value).AppendValue(value)
252+
.AppendValue(value.ToDateTimeOffset(TimeSpan.FromHours(1)))
253+
.AppendValue((TimeOnly?)TimeOnly.FromDateTime(value))
252254
.EndRow();
253255
}
254256
}
255257

256-
var result = Connection.Query<(DateOnly, DateTime, DateTime, DateTime, DateTime, DateTime, DateTimeOffset)>("SELECT a, b, c, d, e, f, g FROM managedAppenderTemporal").ToList();
258+
var result = Connection.Query<(DateOnly, DateTime, DateTime, DateTime, DateTime, DateTime, DateTimeOffset, TimeOnly)>("SELECT a, b, c, d, e, f, g, h FROM managedAppenderTemporal").ToList();
257259

258260
result.Select(tuple => tuple.Item1).Should().BeEquivalentTo(dates.Select(DateOnly.FromDateTime));
259261
result.Select(tuple => tuple.Item2).Should().BeEquivalentTo(dates);
@@ -263,6 +265,7 @@ public void TemporalValues()
263265
result.Select(tuple => tuple.Item6).Should().BeEquivalentTo(dates);
264266
result.Select(tuple => tuple.Item7).Should().BeEquivalentTo(dates.Select(time => time.ToDateTimeOffset(TimeSpan.FromHours(1))),
265267
options => options.ComparingByMembers<DateTimeOffset>().Including(offset => offset.Offset).Including(offset => offset.TimeOfDay));
268+
result.Select(tuple => tuple.Item8).Should().BeEquivalentTo(dates.Select(TimeOnly.FromDateTime));
266269
}
267270

268271
[Fact]

0 commit comments

Comments
 (0)