Skip to content

Commit 49e4a86

Browse files
authored
Add some tests around date/time mappings (#3432)
1 parent c2b3de4 commit 49e4a86

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/EFCore.PG.Tests/Storage/NpgsqlTypeMappingSourceTest.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ public class NpgsqlTypeMappingSourceTest
2828
[InlineData("varchar(8)", typeof(string), 8, null, null, false)]
2929
[InlineData("varchar", typeof(string), null, null, null, false)]
3030
[InlineData("timestamp with time zone", typeof(DateTime), null, null, null, false)]
31+
[InlineData("timestamp without time zone", typeof(DateTime), null, null, null, false)]
32+
[InlineData("date", typeof(DateOnly), null, null, null, false)]
33+
[InlineData("time", typeof(TimeOnly), null, null, null, false)]
34+
[InlineData("time without time zone", typeof(TimeOnly), null, null, null, false)]
35+
[InlineData("interval", typeof(TimeSpan), null, null, null, false)]
3136
[InlineData("dummy", typeof(DummyType), null, null, null, false)]
3237
[InlineData("int4range", typeof(NpgsqlRange<int>), null, null, null, false)]
3338
[InlineData("floatrange", typeof(NpgsqlRange<float>), null, null, null, false)]
@@ -107,6 +112,10 @@ public void Timestamp_without_time_zone_Array_5()
107112
[InlineData(typeof(int), "integer")]
108113
[InlineData(typeof(int[]), "integer[]")]
109114
[InlineData(typeof(byte[]), "bytea")]
115+
[InlineData(typeof(DateTime), "timestamp with time zone")]
116+
[InlineData(typeof(DateOnly), "date")]
117+
[InlineData(typeof(TimeOnly), "time without time zone")]
118+
[InlineData(typeof(TimeSpan), "interval")]
110119
[InlineData(typeof(DummyType), "dummy")]
111120
[InlineData(typeof(NpgsqlRange<int>), "int4range")]
112121
[InlineData(typeof(NpgsqlRange<float>), "floatrange")]
@@ -160,6 +169,10 @@ public void By_ClrType_and_element_precision(Type clrType, string expectedStoreT
160169
[InlineData("integer", typeof(int))]
161170
[InlineData("numeric", typeof(float))]
162171
[InlineData("numeric", typeof(double))]
172+
[InlineData("date", typeof(DateOnly))]
173+
[InlineData("date", typeof(DateTime))]
174+
[InlineData("time", typeof(TimeOnly))]
175+
[InlineData("time", typeof(TimeSpan))]
163176
[InlineData("integer[]", typeof(int[]))]
164177
[InlineData("integer[]", typeof(List<int>))]
165178
[InlineData("smallint[]", typeof(byte[]))]

0 commit comments

Comments
 (0)