1
+ using System . Collections . Generic ;
2
+ using NHibernate . Dialect . Function ;
1
3
using NHibernate . Mapping ;
2
4
3
5
namespace NHibernate . Test . DialectTest
@@ -10,11 +12,13 @@ namespace NHibernate.Test.DialectTest
10
12
public class SQLiteDialectFixture
11
13
{
12
14
private SQLiteDialect dialect ;
15
+ private SQLFunctionRegistry registry ;
13
16
14
17
[ SetUp ]
15
18
public void SetUp ( )
16
19
{
17
20
dialect = new SQLiteDialect ( ) ;
21
+ registry = new SQLFunctionRegistry ( dialect , new Dictionary < string , ISQLFunction > ( ) ) ;
18
22
}
19
23
20
24
[ Test ]
@@ -23,6 +27,22 @@ public void SupportsSubSelect()
23
27
Assert . IsTrue ( dialect . SupportsSubSelects ) ;
24
28
}
25
29
30
+ [ TestCase ( "int" ) , TestCase ( "integer" ) , TestCase ( "tinyint" ) , TestCase ( "smallint" ) , TestCase ( "bigint" ) ]
31
+ [ TestCase ( "numeric" ) , TestCase ( "decimal" ) , TestCase ( "bit" ) , TestCase ( "money" ) , TestCase ( "smallmoney" ) ]
32
+ [ TestCase ( "float" ) , TestCase ( "real" ) , TestCase ( "date" ) , TestCase ( "datetime" ) , TestCase ( "smalldatetime" ) ]
33
+ [ TestCase ( "char" ) , TestCase ( "varchar" ) , TestCase ( "text" ) , TestCase ( "nvarchar" ) , TestCase ( "ntext" ) ]
34
+ [ TestCase ( "binary" ) , TestCase ( "varbinary" ) , TestCase ( "image" ) ]
35
+ [ TestCase ( "cursor" ) , TestCase ( "timestamp" ) , TestCase ( "uniqueidentifier" ) , TestCase ( "sql_variant" ) ]
36
+ public void WhereStringTemplate ( string type )
37
+ {
38
+ if ( ! type . EndsWith ( ")" ) )
39
+ WhereStringTemplate ( type + "(1)" ) ;
40
+
41
+ const string value = "1" ;
42
+ string sql = "(CAST(" + value + " AS " + type + "))" ;
43
+ Assert . AreEqual ( sql , Template . RenderWhereStringTemplate ( sql , dialect , registry ) ) ;
44
+ }
45
+
26
46
[ Test ]
27
47
public void UseLimit ( )
28
48
{
0 commit comments