File tree Expand file tree Collapse file tree 3 files changed +25
-12
lines changed
Expand file tree Collapse file tree 3 files changed +25
-12
lines changed Original file line number Diff line number Diff line change @@ -272,8 +272,7 @@ public void TemporalValues()
272272 result . Select ( tuple => tuple . Item4 ) . Should ( ) . BeEquivalentTo ( dates ) ;
273273 result . Select ( tuple => tuple . Item5 ) . Should ( ) . BeEquivalentTo ( dates ) ;
274274 result . Select ( tuple => tuple . Item6 ) . Should ( ) . BeEquivalentTo ( dates ) ;
275- result . Select ( tuple => tuple . Item7 ) . Should ( ) . BeEquivalentTo ( dates . Select ( time => time . ToDateTimeOffset ( TimeSpan . FromHours ( 1 ) ) ) ,
276- options => options . ComparingByMembers < DateTimeOffset > ( ) . Including ( offset => offset . Offset ) . Including ( offset => offset . TimeOfDay ) ) ;
275+ result . Select ( tuple => tuple . Item7 ) . Should ( ) . BeEquivalentTo ( dates . Select ( time => time . ToDateTimeOffset ( TimeSpan . FromHours ( 1 ) ) ) ) ;
277276 result . Select ( tuple => tuple . Item8 ) . Should ( ) . BeEquivalentTo ( dates . Select ( TimeOnly . FromDateTime ) ) ;
278277 }
279278
Original file line number Diff line number Diff line change 11using DuckDB . NET . Test . Helpers ;
2+ using FluentAssertions ;
23using System ;
3- using System . IO ;
4- using System . Reflection ;
54using System . Runtime . CompilerServices ;
6- using System . Runtime . InteropServices ;
75
86#nullable enable
97namespace DuckDB . NET . Test ;
@@ -13,5 +11,9 @@ public static class ModuleInit
1311 public static void Init ( )
1412 {
1513 NativeLibraryHelper . TryLoad ( ) ;
14+
15+ AssertionOptions . AssertEquivalencyUsing ( options => options . ComparingByMembers < DateTimeOffset > ( ) . Including ( info =>
16+ info . Name == nameof ( DateTimeOffset . Offset ) ||
17+ info . Name == nameof ( DateTimeOffset . TimeOfDay ) ) ) ;
1618 }
1719}
Original file line number Diff line number Diff line change 22using DuckDB . NET . Data ;
33using DuckDB . NET . Native ;
44using FluentAssertions ;
5+ using FluentAssertions . Common ;
56using System ;
67using System . Collections . Generic ;
78using System . Linq ;
@@ -72,8 +73,7 @@ public void CanBindLongList()
7273 [ Fact ]
7374 public void CanBindHugeIntList ( )
7475 {
75- TestInsertSelect ( "HugeInt" ,
76- faker => BigInteger . Subtract ( DuckDBHugeInt . HugeIntMaxValue , faker . Random . Int ( min : 0 ) ) ) ;
76+ TestInsertSelect ( "HugeInt" , faker => BigInteger . Subtract ( DuckDBHugeInt . HugeIntMaxValue , faker . Random . Int ( min : 0 ) ) ) ;
7777 }
7878
7979 [ Fact ]
@@ -130,11 +130,23 @@ public void CanBindDateTimeList()
130130 TestInsertSelect ( "Date" , faker => faker . Date . Past ( ) . Date ) ;
131131 }
132132
133- //[Fact]
134- //public void CanBindDateTimeOffsetList()
135- //{
136- // TestInsertSelect("TimeTZ", faker => faker.Date.PastOffset());
137- //}
133+ [ Fact ]
134+ public void CanBindDateTimeOffsetList ( )
135+ {
136+ TestInsertSelect ( "TimeTZ" , faker =>
137+ {
138+ var dateTime = faker . Date . Between ( DateTime . Now . AddYears ( - 100 ) , DateTime . Now . AddYears ( 100 ) ) ;
139+
140+ if ( dateTime . Hour < 1 )
141+ {
142+ dateTime = dateTime . AddHours ( 1 ) ;
143+ }
144+
145+ dateTime = dateTime . AddTicks ( - dateTime . Ticks % 10 ) ;
146+
147+ return dateTime . ToDateTimeOffset ( TimeSpan . FromHours ( 1 ) ) ;
148+ } ) ;
149+ }
138150
139151 [ Fact ]
140152 public void CanBindStringList ( )
You can’t perform that action at this time.
0 commit comments