File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
Orm/Xtensive.Orm.Tests/Linq/DateTimeAndDateTimeOffset/TimeOnly Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -188,6 +188,37 @@ public void TicksFromColumnsBasedExpressionMilliseconds()
188
188
Assert . That ( result . Count , Is . EqualTo ( 1 ) ) ;
189
189
} ) ;
190
190
}
191
+
192
+ [ Test ]
193
+ public void HourOverflowTest ( )
194
+ {
195
+ Require . ProviderIsNot ( StorageProvider . MySql | StorageProvider . Sqlite ,
196
+ "These providers don't throw exceptions on hour value overflow but return NULL or Max possible value, so no support for time constructor" ) ;
197
+
198
+ var ticksPerHour = new TimeOnly ( 1 , 0 ) . Ticks ;
199
+ var testTicks = FirstMillisecondTimeOnly . Hour + ticksPerHour * 25 ;
200
+
201
+ _ = Assert . Throws < ArgumentOutOfRangeException > ( ( ) => new TimeOnly ( testTicks ) ) ;
202
+
203
+ ExecuteInsideSession ( ( s ) => {
204
+ _ = Assert . Throws ( GetExceptionType ( ) ,
205
+ ( ) => s . Query . All < AllPossiblePartsEntity > ( )
206
+ . Select ( e => new {
207
+ Entity = e ,
208
+ ConstructedTime = new TimeOnly ( e . Hour + ticksPerHour * 25 )
209
+ } )
210
+ . Where ( a => a . ConstructedTime == FirstMillisecondTimeOnly )
211
+ . OrderBy ( a => a . Entity . Id ) . Run ( ) ) ;
212
+ } ) ;
213
+
214
+ static Type GetExceptionType ( )
215
+ {
216
+ return StorageProviderInfo . Instance . Provider switch {
217
+ StorageProvider . SqlServer => typeof ( SyntaxErrorException ) ,
218
+ _ => typeof ( StorageException )
219
+ } ;
220
+ }
221
+ }
191
222
}
192
223
}
193
224
#endif
You can’t perform that action at this time.
0 commit comments