|
From: <ric...@us...> - 2009-07-02 21:24:12
|
Revision: 4563
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4563&view=rev
Author: ricbrown
Date: 2009-07-02 21:24:11 +0000 (Thu, 02 Jul 2009)
Log Message:
-----------
Migrated some more test coverage over from lambda extensions project.
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Impl/ExpressionProcessor.cs
trunk/nhibernate/src/NHibernate.Test/Criteria/Lambda/QueryOverFixture.cs
Modified: trunk/nhibernate/src/NHibernate/Impl/ExpressionProcessor.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Impl/ExpressionProcessor.cs 2009-07-02 21:02:37 UTC (rev 4562)
+++ trunk/nhibernate/src/NHibernate/Impl/ExpressionProcessor.cs 2009-07-02 21:24:11 UTC (rev 4563)
@@ -142,7 +142,12 @@
MethodCallExpression methodCallExpression = (MethodCallExpression)expression;
if (methodCallExpression.Method.Name == "GetType")
- return FindMemberExpression(methodCallExpression.Object) + ".class";
+ {
+ if (methodCallExpression.Object.NodeType == ExpressionType.MemberAccess)
+ return FindMemberExpression(methodCallExpression.Object) + ".class";
+ else
+ return "class";
+ }
throw new Exception("Unrecognised method call in epression " + expression.ToString());
}
Modified: trunk/nhibernate/src/NHibernate.Test/Criteria/Lambda/QueryOverFixture.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/Criteria/Lambda/QueryOverFixture.cs 2009-07-02 21:02:37 UTC (rev 4562)
+++ trunk/nhibernate/src/NHibernate.Test/Criteria/Lambda/QueryOverFixture.cs 2009-07-02 21:24:11 UTC (rev 4563)
@@ -25,7 +25,8 @@
.Add(Restrictions.Gt("Age", 10))
.Add(Restrictions.Ge("Age", 11))
.Add(Restrictions.Lt("Age", 50))
- .Add(Restrictions.Le("Age", 49));
+ .Add(Restrictions.Le("Age", 49))
+ .Add(Restrictions.Eq("class", typeof(Person)));
IQueryOver<Person> actual =
CreateTestQueryOver<Person>()
@@ -34,7 +35,8 @@
.And(p => p.Age > 10)
.And(p => p.Age >= 11)
.And(p => p.Age < 50)
- .And(p => p.Age <= 49);
+ .And(p => p.Age <= 49)
+ .And(p => p.GetType() == typeof(Person));
AssertCriteriaAreEqual(expected, actual);
}
@@ -103,12 +105,24 @@
{
ICriteria expected =
CreateTestCriteria(typeof(Person), "personAlias")
- .Add(Restrictions.Eq("personAlias.Name", "test name"));
+ .Add(Restrictions.Eq("personAlias.Name", "test name"))
+ .Add(Restrictions.Not(Restrictions.Eq("personAlias.Name", "not test name")))
+ .Add(Restrictions.Gt("personAlias.Age", 10))
+ .Add(Restrictions.Ge("personAlias.Age", 11))
+ .Add(Restrictions.Lt("personAlias.Age", 50))
+ .Add(Restrictions.Le("personAlias.Age", 49))
+ .Add(Restrictions.Eq("personAlias.class", typeof(Person)));
Person personAlias = null;
IQueryOver<Person> actual =
CreateTestQueryOver<Person>(() => personAlias)
- .Where(() => personAlias.Name == "test name");
+ .Where(() => personAlias.Name == "test name")
+ .And(() => personAlias.Name != "not test name")
+ .And(() => personAlias.Age > 10)
+ .And(() => personAlias.Age >= 11)
+ .And(() => personAlias.Age < 50)
+ .And(() => personAlias.Age <= 49)
+ .And(() => personAlias.GetType() == typeof(Person));
AssertCriteriaAreEqual(expected, actual);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|