diff --git a/DuckDB.NET.Test/DuckDBDataReaderListTests.cs b/DuckDB.NET.Test/DuckDBDataReaderListTests.cs index 404871ed..d436fe22 100644 --- a/DuckDB.NET.Test/DuckDBDataReaderListTests.cs +++ b/DuckDB.NET.Test/DuckDBDataReaderListTests.cs @@ -171,6 +171,49 @@ public void ReadListWithDapper() person.Mood.Should().Be(DuckDBDataReaderEnumTests.Mood.Happy); } + [Fact] + public void ReadListAsEveryNumericType() + { + Command.CommandText = "SELECT [1, 2, 3];"; + using var reader = Command.ExecuteReader(); + reader.Read(); + + TestReadValueAs(); + TestReadValueAs(); + TestReadValueAs(); + TestReadValueAs(); + TestReadValueAs(); + TestReadValueAs(); + TestReadValueAs(); + TestReadValueAs(); + + void TestReadValueAs() + { + var list = reader.GetFieldValue>(0); + list.Should().BeEquivalentTo(new List { 1, 2, 3 }); + } + } + + [Fact] + public void ReadListWithLargeValuesAsEveryNumericTypeThrowsException() + { + Command.CommandText = $"SELECT [{long.MaxValue - 1}, {long.MaxValue}];"; + using var reader = Command.ExecuteReader(); + reader.Read(); + + TestReadValueAs(); + TestReadValueAs(); + TestReadValueAs(); + TestReadValueAs(); + TestReadValueAs(); + TestReadValueAs(); + + void TestReadValueAs() + { + reader.Invoking(dataReader => dataReader.GetFieldValue>(0)).Should().Throw(); + } + } + class Person { public List Ids { get; set; }