@@ -10,6 +10,12 @@ namespace NHibernate.Test.Linq
1010public class MathTests : LinqTestCase
1111{
1212private IQueryable < OrderLine > _orderLines ;
13+
14+ private void IgnoreIfNotSupported ( string function )
15+ {
16+ if ( ! Dialect . Functions . ContainsKey ( function ) )
17+ Assert . Ignore ( "Dialect {0} does not support '{1}' function" , Dialect . GetType ( ) , function ) ;
18+ }
1319
1420protected override void OnSetUp ( )
1521{
@@ -20,6 +26,7 @@ protected override void OnSetUp()
2026[ Test ]
2127public void SignAllPositiveTest ( )
2228{
29+ IgnoreIfNotSupported ( "sign" ) ;
2330var signs = ( from o in db . OrderLines
2431 select Math . Sign ( o . UnitPrice ) ) . ToList ( ) ;
2532
@@ -29,6 +36,7 @@ public void SignAllPositiveTest()
2936[ Test ]
3037public void SignAllNegativeTest ( )
3138{
39+ IgnoreIfNotSupported ( "sign" ) ;
3240var signs = ( from o in db . OrderLines
3341 select Math . Sign ( - 1 * o . UnitPrice ) ) . ToList ( ) ;
3442
@@ -38,61 +46,71 @@ public void SignAllNegativeTest()
3846[ Test ]
3947public void SinTest ( )
4048{
41- Test ( o => Math . Sin ( ( double ) o . UnitPrice ) ) ;
49+ IgnoreIfNotSupported ( "sin" ) ;
50+ Test ( o => Math . Sin ( ( double ) o . UnitPrice ) ) ;
4251}
4352
4453[ Test ]
4554public void CosTest ( )
4655{
47- Test ( o => Math . Cos ( ( double ) o . UnitPrice ) ) ;
56+ IgnoreIfNotSupported ( "cos" ) ;
57+ Test ( o => Math . Cos ( ( double ) o . UnitPrice ) ) ;
4858}
49-
59+
5060[ Test ]
5161public void TanTest ( )
5262{
53- Test ( o => Math . Tan ( ( double ) o . UnitPrice ) ) ;
63+ IgnoreIfNotSupported ( "tan" ) ;
64+ Test ( o => Math . Tan ( ( double ) o . Discount ) ) ;
5465}
5566
5667[ Test ]
5768public void SinhTest ( )
5869{
59- Test ( o => Math . Sinh ( ( double ) o . UnitPrice ) ) ;
70+ IgnoreIfNotSupported ( "sinh" ) ;
71+ Test ( o => Math . Sinh ( ( double ) o . Discount ) ) ;
6072}
6173
6274[ Test ]
6375public void CoshTest ( )
6476{
65- Test ( o => Math . Cosh ( ( double ) o . UnitPrice ) ) ;
77+ IgnoreIfNotSupported ( "cosh" ) ;
78+ Test ( o => Math . Cosh ( ( double ) o . Discount ) ) ;
6679}
6780
6881[ Test ]
6982public void TanhTest ( )
7083{
71- Test ( o => Math . Tanh ( ( double ) o . UnitPrice ) ) ;
84+ IgnoreIfNotSupported ( "tanh" ) ;
85+ Test ( o => Math . Tanh ( ( double ) o . Discount ) ) ;
7286}
7387
7488[ Test ]
7589public void AsinTest ( )
7690{
77- Test ( o => Math . Asin ( ( double ) o . UnitPrice ) ) ;
91+ IgnoreIfNotSupported ( "asin" ) ;
92+ Test ( o => Math . Asin ( ( double ) o . Discount ) ) ;
7893}
7994
8095[ Test ]
8196public void AcosTest ( )
8297{
83- Test ( o => Math . Acos ( ( double ) o . UnitPrice ) ) ;
98+ IgnoreIfNotSupported ( "acos" ) ;
99+ Test ( o => Math . Acos ( ( double ) o . Discount ) ) ;
84100}
85-
101+
86102[ Test ]
87103public void AtanTest ( )
88104{
89- Test ( o => Math . Atan ( ( double ) o . UnitPrice ) ) ;
105+ IgnoreIfNotSupported ( "atan" ) ;
106+ Test ( o => Math . Atan ( ( double ) o . UnitPrice ) ) ;
90107}
91108
92109[ Test ]
93110public void Atan2Test ( )
94111{
95- Test ( o => Math . Atan2 ( ( double ) o . UnitPrice , 0.5d ) ) ;
112+ IgnoreIfNotSupported ( "atan2" ) ;
113+ Test ( o => Math . Atan2 ( ( double ) o . Discount , 0.5d ) ) ;
96114}
97115
98116private void Test < T > ( Expression < Func < OrderLine , T > > selector )
0 commit comments