1+ using System . Collections . Generic ;
2+ using NHibernate . Dialect . Function ;
13using NHibernate . Mapping ;
24
35namespace NHibernate . Test . DialectTest
@@ -10,11 +12,13 @@ namespace NHibernate.Test.DialectTest
1012 public class SQLiteDialectFixture
1113 {
1214 private SQLiteDialect dialect ;
15+ private SQLFunctionRegistry registry ;
1316
1417 [ SetUp ]
1518 public void SetUp ( )
1619 {
1720 dialect = new SQLiteDialect ( ) ;
21+ registry = new SQLFunctionRegistry ( dialect , new Dictionary < string , ISQLFunction > ( ) ) ;
1822 }
1923
2024 [ Test ]
@@ -23,6 +27,22 @@ public void SupportsSubSelect()
2327 Assert . IsTrue ( dialect . SupportsSubSelects ) ;
2428 }
2529
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+
2646 [ Test ]
2747 public void UseLimit ( )
2848 {
0 commit comments