Skip to content

Commit baae3af

Browse files
Address comment and add tests
1 parent 91ad2ee commit baae3af

File tree

2 files changed

+45
-8
lines changed

2 files changed

+45
-8
lines changed

src/NHibernate.Test/Criteria/Lambda/QueryOverFixture.cs

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
using System;
2-
using System.Collections;
3-
42
using NUnit.Framework;
5-
63
using NHibernate.Criterion;
74
using NHibernate.SqlCommand;
85
using NHibernate.Transform;
9-
using NHibernate.Type;
10-
using NHibernate.Util;
116

127
namespace NHibernate.Test.Criteria.Lambda
138
{
@@ -928,6 +923,48 @@ public void Readonly()
928923
AssertCriteriaAreEqual(expected, actual);
929924
}
930925

926+
[Test]
927+
public void SetTimeout()
928+
{
929+
var expected =
930+
CreateTestCriteria(typeof(Person))
931+
.SetTimeout(3);
932+
933+
var actual =
934+
CreateTestQueryOver<Person>()
935+
.SetTimeout(3);
936+
937+
AssertCriteriaAreEqual(expected, actual);
938+
}
939+
940+
[Test]
941+
public void SetFetchSize()
942+
{
943+
var expected =
944+
CreateTestCriteria(typeof(Person))
945+
.SetFetchSize(3);
946+
947+
var actual =
948+
CreateTestQueryOver<Person>()
949+
.SetFetchSize(3);
950+
951+
AssertCriteriaAreEqual(expected, actual);
952+
}
953+
954+
[Test]
955+
public void SetComment()
956+
{
957+
var expected =
958+
CreateTestCriteria(typeof(Person))
959+
.SetComment("blah");
960+
961+
var actual =
962+
CreateTestQueryOver<Person>()
963+
.SetComment("blah");
964+
965+
AssertCriteriaAreEqual(expected, actual);
966+
}
967+
931968
[Test]
932969
public void DetachedQueryOver()
933970
{

src/NHibernate/QueryOverExtensions.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public static class QueryOverExtensions
99
/// <param name="queryOver">The query on which to set the timeout.</param>
1010
/// <param name="timeout">The timeout in seconds.</param>
1111
/// <returns><see langword="this" /> (for method chaining).</returns>
12-
public static IQueryOver<TRoot> SetTimeout<TRoot>(this IQueryOver<TRoot> queryOver, int timeout)
12+
public static TQueryOver SetTimeout<TQueryOver>(this TQueryOver queryOver, int timeout) where TQueryOver: IQueryOver
1313
{
1414
queryOver.RootCriteria.SetTimeout(timeout);
1515
return queryOver;
@@ -21,7 +21,7 @@ public static IQueryOver<TRoot> SetTimeout<TRoot>(this IQueryOver<TRoot> queryOv
2121
/// <param name="queryOver">The query on which to set the timeout.</param>
2222
/// <param name="fetchSize">The fetch size.</param>
2323
/// <returns><see langword="this" /> (for method chaining).</returns>
24-
public static IQueryOver<TRoot> SetFetchSize<TRoot>(this IQueryOver<TRoot> queryOver, int fetchSize)
24+
public static TQueryOver SetFetchSize<TQueryOver>(this TQueryOver queryOver, int fetchSize) where TQueryOver: IQueryOver
2525
{
2626
queryOver.RootCriteria.SetFetchSize(fetchSize);
2727
return queryOver;
@@ -33,7 +33,7 @@ public static IQueryOver<TRoot> SetFetchSize<TRoot>(this IQueryOver<TRoot> query
3333
/// <param name="queryOver">The query on which to set the timeout.</param>
3434
/// <param name="comment">A human-readable string.</param>
3535
/// <returns><see langword="this" /> (for method chaining).</returns>
36-
public static IQueryOver<TRoot> SetComment<TRoot>(this IQueryOver<TRoot> queryOver, string comment)
36+
public static TQueryOver SetComment<TQueryOver>(this TQueryOver queryOver, string comment) where TQueryOver: IQueryOver
3737
{
3838
queryOver.RootCriteria.SetComment(comment);
3939
return queryOver;

0 commit comments

Comments
 (0)