@@ -6,26 +6,65 @@ namespace NHibernate.Test.DialectTest
6
6
{
7
7
[ TestFixture ]
8
8
public class FirebirdDialectFixture
9
- {
10
- [ Test ]
11
- public void GetLimitString ( )
12
- {
13
- FirebirdDialect d = new FirebirdDialect ( ) ;
9
+ {
10
+ #region Tests
11
+ [ Test ]
12
+ public void GetLimitString ( )
13
+ {
14
+ FirebirdDialect d = MakeDialect ( ) ;
14
15
15
- SqlString str = d . GetLimitString ( new SqlString ( "SELECT * FROM fish" ) , null , new SqlString ( "10" ) ) ;
16
- Assert . AreEqual ( "SELECT first 10 * FROM fish" , str . ToString ( ) ) ;
16
+ SqlString str = d . GetLimitString ( new SqlString ( "SELECT * FROM fish" ) , null , new SqlString ( "10" ) ) ;
17
+ Assert . AreEqual ( "SELECT first 10 * FROM fish" , str . ToString ( ) ) ;
17
18
18
- str = d . GetLimitString ( new SqlString ( "SELECT * FROM fish ORDER BY name" ) , new SqlString ( "5" ) , new SqlString ( "15" ) ) ;
19
- Assert . AreEqual ( "SELECT first 15 skip 5 * FROM fish ORDER BY name" , str . ToString ( ) ) ;
19
+ str = d . GetLimitString ( new SqlString ( "SELECT * FROM fish ORDER BY name" ) , new SqlString ( "5" ) , new SqlString ( "15" ) ) ;
20
+ Assert . AreEqual ( "SELECT first 15 skip 5 * FROM fish ORDER BY name" , str . ToString ( ) ) ;
20
21
21
- str = d . GetLimitString ( new SqlString ( "SELECT * FROM fish ORDER BY name DESC" ) , new SqlString ( "7" ) , new SqlString ( "28" ) ) ;
22
- Assert . AreEqual ( "SELECT first 28 skip 7 * FROM fish ORDER BY name DESC" , str . ToString ( ) ) ;
22
+ str = d . GetLimitString ( new SqlString ( "SELECT * FROM fish ORDER BY name DESC" ) , new SqlString ( "7" ) , new SqlString ( "28" ) ) ;
23
+ Assert . AreEqual ( "SELECT first 28 skip 7 * FROM fish ORDER BY name DESC" , str . ToString ( ) ) ;
23
24
24
- str = d . GetLimitString ( new SqlString ( "SELECT DISTINCT fish.family FROM fish ORDER BY name DESC" ) , null , new SqlString ( "28" ) ) ;
25
- Assert . AreEqual ( "SELECT first 28 DISTINCT fish.family FROM fish ORDER BY name DESC" , str . ToString ( ) ) ;
25
+ str = d . GetLimitString ( new SqlString ( "SELECT DISTINCT fish.family FROM fish ORDER BY name DESC" ) , null , new SqlString ( "28" ) ) ;
26
+ Assert . AreEqual ( "SELECT first 28 DISTINCT fish.family FROM fish ORDER BY name DESC" , str . ToString ( ) ) ;
26
27
27
- str = d . GetLimitString ( new SqlString ( "SELECT DISTINCT fish.family FROM fish ORDER BY name DESC" ) , new SqlString ( "7" ) , new SqlString ( "28" ) ) ;
28
- Assert . AreEqual ( "SELECT first 28 skip 7 DISTINCT fish.family FROM fish ORDER BY name DESC" , str . ToString ( ) ) ;
29
- }
30
- }
28
+ str = d . GetLimitString ( new SqlString ( "SELECT DISTINCT fish.family FROM fish ORDER BY name DESC" ) , new SqlString ( "7" ) , new SqlString ( "28" ) ) ;
29
+ Assert . AreEqual ( "SELECT first 28 skip 7 DISTINCT fish.family FROM fish ORDER BY name DESC" , str . ToString ( ) ) ;
30
+ }
31
+
32
+ [ Test ]
33
+ public void GetTypeName_DecimalWithoutPrecisionAndScale_ReturnsDecimalWithPrecisionOf18AndScaleOf5 ( )
34
+ {
35
+ var fbDialect = MakeDialect ( ) ;
36
+
37
+ var result = fbDialect . GetTypeName ( NHibernateUtil . Decimal . SqlType ) ;
38
+
39
+ Assert . AreEqual ( "DECIMAL(18, 5)" , result ) ;
40
+ }
41
+
42
+ [ Test ]
43
+ public void GetTypeName_DecimalWithPrecisionAndScale_ReturnsPrecisedAndScaledDecimal ( )
44
+ {
45
+ var fbDialect = MakeDialect ( ) ;
46
+
47
+ var result = fbDialect . GetTypeName ( NHibernateUtil . Decimal . SqlType , 0 , 17 , 2 ) ;
48
+
49
+ Assert . AreEqual ( "DECIMAL(17, 2)" , result ) ;
50
+ }
51
+
52
+ [ Test ]
53
+ public void GetTypeName_DecimalWithPrecisionGreaterThanFbMaxPrecision_ReturnsDecimalWithFbMaxPrecision ( )
54
+ {
55
+ var fbDialect = MakeDialect ( ) ;
56
+
57
+ var result = fbDialect . GetTypeName ( NHibernateUtil . Decimal . SqlType , 0 , 19 , 2 ) ; //Firebird allows a maximum precision of 18
58
+
59
+ Assert . AreEqual ( "DECIMAL(18, 2)" , result ) ;
60
+ }
61
+ #endregion
62
+
63
+ #region Private Members
64
+ private static FirebirdDialect MakeDialect ( )
65
+ {
66
+ return new FirebirdDialect ( ) ;
67
+ }
68
+ #endregion
69
+ }
31
70
}
0 commit comments