Skip to content

Commit da37be0

Browse files
committed
Ignore linq math function tests are not supported by dialect
1 parent b31e982 commit da37be0

File tree

1 file changed

+30
-12
lines changed

1 file changed

+30
-12
lines changed

src/NHibernate.Test/Linq/MathTests.cs

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ namespace NHibernate.Test.Linq
1010
public class MathTests : LinqTestCase
1111
{
1212
private 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

1420
protected override void OnSetUp()
1521
{
@@ -20,6 +26,7 @@ protected override void OnSetUp()
2026
[Test]
2127
public void SignAllPositiveTest()
2228
{
29+
IgnoreIfNotSupported("sign");
2330
var signs = (from o in db.OrderLines
2431
select Math.Sign(o.UnitPrice)).ToList();
2532

@@ -29,6 +36,7 @@ public void SignAllPositiveTest()
2936
[Test]
3037
public void SignAllNegativeTest()
3138
{
39+
IgnoreIfNotSupported("sign");
3240
var signs = (from o in db.OrderLines
3341
select Math.Sign(-1*o.UnitPrice)).ToList();
3442

@@ -38,61 +46,71 @@ public void SignAllNegativeTest()
3846
[Test]
3947
public 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]
4554
public 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]
5161
public 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]
5768
public 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]
6375
public 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]
6982
public 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]
7589
public 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]
8196
public 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]
87103
public 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]
93110
public 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

98116
private void Test<T>(Expression<Func<OrderLine, T>> selector)

0 commit comments

Comments
 (0)