Skip to content

Commit 7c54326

Browse files
committed
NH-1675 - Restrict test to SqlServer 2005 & 2008 dialects
1 parent 1564d3c commit 7c54326

File tree

1 file changed

+22
-11
lines changed
  • src/NHibernate.Test/NHSpecificTest/NH1675

1 file changed

+22
-11
lines changed

Diff for: src/NHibernate.Test/NHSpecificTest/NH1675/Fixture.cs

+22-11
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,43 @@
1+
using NHibernate.Dialect;
12
using NUnit.Framework;
23

34
namespace NHibernate.Test.NHSpecificTest.NH1675
45
{
56
[TestFixture]
67
public class Fixture : BugTestCase
78
{
8-
[Test]
9-
public void ShouldWorkUsingDistinctAndLimits()
9+
protected override bool AppliesTo(Dialect.Dialect dialect)
10+
{
11+
return dialect.GetType() == typeof(MsSql2005Dialect) || dialect.GetType() == typeof(MsSql2008Dialect);
12+
}
13+
14+
protected override void OnSetUp()
1015
{
11-
using (ISession s = OpenSession())
12-
using (ITransaction tx = s.BeginTransaction())
16+
using (var s = OpenSession())
17+
using (var tx = s.BeginTransaction())
1318
{
14-
for (int i = 0; i < 5; i++)
19+
for (var i = 0; i < 5; i++)
1520
{
1621
s.Save(new Person {FirstName = "Name" + i});
1722
}
1823
tx.Commit();
1924
}
25+
}
2026

21-
using (ISession s = OpenSession())
27+
[Test]
28+
public void ShouldWorkUsingDistinctAndLimits()
29+
{
30+
using (var s = OpenSession())
2231
{
23-
var q =s.CreateQuery("select distinct p from Person p").SetFirstResult(0).SetMaxResults(10);
24-
Assert.That(q.List().Count, Is.EqualTo(5));
32+
var q = s.CreateQuery("select distinct p from Person p").SetFirstResult(0).SetMaxResults(10);
33+
Assert.That(q.List(), Has.Count.EqualTo(5));
2534
}
35+
}
2636

27-
// clean up
28-
using (ISession s = OpenSession())
29-
using (ITransaction tx = s.BeginTransaction())
37+
protected override void OnTearDown()
38+
{
39+
using (var s = OpenSession())
40+
using (var tx = s.BeginTransaction())
3041
{
3142
s.Delete("from Person");
3243
tx.Commit();

0 commit comments

Comments
 (0)