using System;
using System.Data;
using System.Text;

using NHibernate.Engine;
using NExpression = NHibernate.Expression;
using NHibernate.SqlCommand;
using NHibernate.Type;

using NHibernate.DomainModel;
using NUnit.Framework;

namespace NHibernate.Test.ExpressionTest
{
	/// <summary>
	/// Summary description for InsensitiveLikeExpressionFixture.
	/// </summary>
	[TestFixture]
	public class InsensitiveLikeExpressionFixture : BaseExpressionFixture
	{
		[Test]
		public void InsentitiveLikeSqlStringTest() 
		{
			
			ISession session = factory.OpenSession();
			
			NExpression.Expression expression = NExpression.Expression.InsensitiveLike("Address", "12 Adress");

			SqlString sqlString = expression.ToSqlString(factoryImpl, typeof(Simple), "simple_alias");
			
			string expectedSql = "lower(simple_alias.address) like :simple_alias.address";
			Parameter[] expectedParams = new Parameter[1];

			Parameter firstParam = new Parameter( "address", "simple_alias", new SqlTypes.StringSqlType() );
			expectedParams[0] = firstParam;

			CompareSqlStrings(sqlString, expectedSql, expectedParams);

			session.Close();
		}


	}
}

using System;
using System.Data;
using System.Text;

using NHibernate.Engine;
using NExpression = NHibernate.Expression;
using NHibernate.SqlCommand;
using NHibernate.Type;

using NHibernate.DomainModel;
using NUnit.Framework;

namespace NHibernate.Test.ExpressionTest
{
	/// <summary>
	/// Summary description for InsensitiveLikeExpressionFixture.
	/// </summary>
	[TestFixture]
	public class InsensitiveLikeExpressionFixture : BaseExpressionFixture
	{
		[Test]
		public void InsentitiveLikeSqlStringTest() 
		{
			
			ISession session = factory.OpenSession();
			
			NExpression.Expression expression = NExpression.Expression.InsensitiveLike("Address", "12 Adress");

			SqlString sqlString = expression.ToSqlString(factoryImpl, typeof(Simple), "simple_alias");
			
			string expectedSql = "lower(simple_alias.address) like :simple_alias.address";
			if ((factory as ISessionFactoryImplementor).Dialect is Dialect.PostgreSQLDialect)
			{
				expectedSql = "simple_alias.address ilike :simple_alias.address";
			}
			Parameter[] expectedParams = new Parameter[1];

			Parameter firstParam = new Parameter( "address", "simple_alias", new SqlTypes.StringSqlType() );
			expectedParams[0] = firstParam;

			CompareSqlStrings(sqlString, expectedSql, expectedParams);

			session.Close();
		}


	}
}

Make the test pass for PostgreSQL, using a bit of a hack
Make the test pass for PostgreSQL, using a bit of a hack


SVN: 488784591515bd4cdaa016be4ec9b172dc4e7caf@1282
