forked from nhibernate/nhibernate-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLogicalExpressionFixture.cs
37 lines (31 loc) · 1007 Bytes
/
LogicalExpressionFixture.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using System;
using NHibernate.DomainModel;
using NHibernate.Criterion;
using NHibernate.SqlCommand;
using NUnit.Framework;
namespace NHibernate.Test.ExpressionTest
{
/// <summary>
/// Test the LogicalExpression class.
/// </summary>
/// <remarks>
/// There are no need for the subclasses AndExpression and OrExpression to have their own
/// TestFixtures because all they do is override one property.
/// </remarks>
[TestFixture]
public class LogicalExpressionFixture : BaseExpressionFixture
{
[Test]
public void LogicalSqlStringTest()
{
ISession session = factory.OpenSession();
ICriterion orExpression =
Expression.Or(Expression.IsNull("Address"), Expression.Between("Count", 5, 10));
CreateObjects(typeof(Simple), session);
SqlString sqlString = orExpression.ToSqlString(criteria, criteriaQuery);
string expectedSql = "(sql_alias.address is null or sql_alias.count_ between ? and ?)";
CompareSqlStrings(sqlString, expectedSql, 2);
session.Close();
}
}
}