Skip to content

Commit 26f8f96

Browse files
committed
NH-3045 - Add tests
1 parent e1ae0d4 commit 26f8f96

File tree

4 files changed

+27
-8
lines changed

4 files changed

+27
-8
lines changed

src/NHibernate.Test/KnownBugAttribute.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,21 @@ namespace NHibernate.Test
44
{
55
public class KnownBugAttribute : ExpectedExceptionAttribute
66
{
7-
public KnownBugAttribute()
7+
public KnownBugAttribute(string bug)
88
{
9-
UserMessage = "Known bug";
9+
UserMessage = "Known bug " + bug;
1010
}
1111

12-
public KnownBugAttribute(System.Type exceptionType) : base(exceptionType)
12+
public KnownBugAttribute(string bug, System.Type exceptionType)
13+
: base(exceptionType)
1314
{
14-
UserMessage = "Known bug";
15+
UserMessage = "Known bug " + bug;
1516
}
1617

17-
public KnownBugAttribute(string exceptionName) : base(exceptionName)
18+
public KnownBugAttribute(string bug, string exceptionName)
19+
: base(exceptionName)
1820
{
19-
UserMessage = "Known bug";
21+
UserMessage = "Known bug " + bug;
2022
}
2123
}
2224
}

src/NHibernate.Test/Linq/ByMethod/GroupByTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System.Linq;
55
using System.Text.RegularExpressions;
66
using NHibernate.DomainModel.Northwind.Entities;
7+
using NHibernate.Linq;
78
using NUnit.Framework;
89

910
namespace NHibernate.Test.Linq.ByMethod

src/NHibernate.Test/Linq/SelectionTests.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,22 @@ public void CanSelectWithAggregateSubQuery()
296296
Assert.AreEqual(4, timesheets[2].EntryCount);
297297
}
298298

299+
[Test, KnownBug("NH-3045")]
300+
public void CanSelectFirstElementFromChildCollection()
301+
{
302+
using (var log = new SqlLogSpy())
303+
{
304+
var orders = db.Customers
305+
.Select(customer => customer.Orders.OrderByDescending(x => x.OrderDate).First())
306+
.ToList();
307+
308+
Assert.That(orders, Has.Count.GreaterThan(0));
309+
310+
var text = log.GetWholeLog();
311+
var count = text.Split(new[] { "SELECT" }, StringSplitOptions.None).Length - 1;
312+
Assert.That(count, Is.EqualTo(1));
313+
}
314+
}
299315

300316
[Test]
301317
public void CanSelectWrappedType()

src/NHibernate.Test/NHSpecificTest/NH2692/Fixture.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public void QueryingParentWhichHasChildren()
2121
}
2222
}
2323

24-
[Test, KnownBug]
24+
[Test, KnownBug("NH-2692")]
2525
public void QueryingChildrenComponents()
2626
{
2727
using (var session = OpenSession())
@@ -35,7 +35,7 @@ public void QueryingChildrenComponents()
3535
}
3636
}
3737

38-
[Test, KnownBug]
38+
[Test, KnownBug("NH-2692")]
3939
public void QueryingChildrenComponentsHql()
4040
{
4141
using (var session = OpenSession())

0 commit comments

Comments
 (0)