@@ -1058,6 +1058,53 @@ public async Task Current_TimeStamp_OffsetAsync()
1058
1058
}
1059
1059
}
1060
1060
1061
+ [ Test ]
1062
+ public async Task Current_DateAsync ( )
1063
+ {
1064
+ AssumeFunctionSupported ( "current_date" ) ;
1065
+ using ( var s = OpenSession ( ) )
1066
+ {
1067
+ var a1 = new Animal ( "abcdef" , 1.3f ) ;
1068
+ await ( s . SaveAsync ( a1 ) ) ;
1069
+ await ( s . FlushAsync ( ) ) ;
1070
+ }
1071
+ using ( var s = OpenSession ( ) )
1072
+ {
1073
+ var hql = "select current_date() from Animal" ;
1074
+ await ( s . CreateQuery ( hql ) . ListAsync ( ) ) ;
1075
+ }
1076
+ }
1077
+
1078
+ [ Test ]
1079
+ public async Task Current_Date_IsLowestTimeOfDayAsync ( )
1080
+ {
1081
+ AssumeFunctionSupported ( "current_date" ) ;
1082
+ var now = DateTime . Now ;
1083
+ if ( ! TestDialect . SupportsNonDataBoundCondition )
1084
+ Assert . Ignore ( "Test is not supported by the target database" ) ;
1085
+ if ( now . TimeOfDay < TimeSpan . FromMinutes ( 5 ) || now . TimeOfDay > TimeSpan . Parse ( "23:55" ) )
1086
+ Assert . Ignore ( "Test is unreliable around midnight" ) ;
1087
+
1088
+ var lowTimeDate = now . Date . AddSeconds ( 1 ) ;
1089
+
1090
+ using ( var s = OpenSession ( ) )
1091
+ {
1092
+ var a1 = new Animal ( "abcdef" , 1.3f ) ;
1093
+ await ( s . SaveAsync ( a1 ) ) ;
1094
+ await ( s . FlushAsync ( ) ) ;
1095
+ }
1096
+ using ( var s = OpenSession ( ) )
1097
+ {
1098
+ var hql = "from Animal where current_date() < :lowTimeDate" ;
1099
+ var result =
1100
+ await ( s
1101
+ . CreateQuery ( hql )
1102
+ . SetDateTime ( "lowTimeDate" , lowTimeDate )
1103
+ . ListAsync ( ) ) ;
1104
+ Assert . That ( result , Has . Count . GreaterThan ( 0 ) ) ;
1105
+ }
1106
+ }
1107
+
1061
1108
[ Test ]
1062
1109
public async Task ExtractAsync ( )
1063
1110
{
0 commit comments