From: <pa...@us...> - 2011-05-28 05:34:48
|
Revision: 5873 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5873&view=rev Author: patearl Date: 2011-05-28 05:34:42 +0000 (Sat, 28 May 2011) Log Message: ----------- Tests: Linq test for coalesce operator. Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/Linq/FunctionTests.cs Modified: trunk/nhibernate/src/NHibernate.Test/Linq/FunctionTests.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/Linq/FunctionTests.cs 2011-05-25 22:58:47 UTC (rev 5872) +++ trunk/nhibernate/src/NHibernate.Test/Linq/FunctionTests.cs 2011-05-28 05:34:42 UTC (rev 5873) @@ -1,4 +1,6 @@ using System.Linq; +using NHibernate.DomainModel.Northwind.Entities; +using NHibernate.Linq; using NUnit.Framework; namespace NHibernate.Test.Linq @@ -110,5 +112,11 @@ Assert.AreEqual(498, query.Count()); } + + [Test] + public void Coalesce() + { + Assert.AreEqual(2, session.Query<AnotherEntity>().Where(e => (e.Input ?? "hello") == "hello").Count()); + } } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pa...@us...> - 2011-05-28 06:55:04
|
Revision: 5875 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5875&view=rev Author: patearl Date: 2011-05-28 06:54:58 +0000 (Sat, 28 May 2011) Log Message: ----------- Tests: Fixed a typo in a test. Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/Linq/FunctionTests.cs Modified: trunk/nhibernate/src/NHibernate.Test/Linq/FunctionTests.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/Linq/FunctionTests.cs 2011-05-28 06:39:13 UTC (rev 5874) +++ trunk/nhibernate/src/NHibernate.Test/Linq/FunctionTests.cs 2011-05-28 06:54:58 UTC (rev 5875) @@ -139,7 +139,7 @@ } finally { - session.Delete("from AnotherEntity where Id >= 100"); + session.Delete("from AnotherEntity e where e.Id >= 100"); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pa...@us...> - 2011-05-28 07:12:13
|
Revision: 5876 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5876&view=rev Author: patearl Date: 2011-05-28 07:12:07 +0000 (Sat, 28 May 2011) Log Message: ----------- Tests: Fixed orphaned objects left by Trim test. Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/Linq/FunctionTests.cs Modified: trunk/nhibernate/src/NHibernate.Test/Linq/FunctionTests.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/Linq/FunctionTests.cs 2011-05-28 06:54:58 UTC (rev 5875) +++ trunk/nhibernate/src/NHibernate.Test/Linq/FunctionTests.cs 2011-05-28 07:12:07 UTC (rev 5876) @@ -124,9 +124,10 @@ { try { - session.Save(new AnotherEntity { Id = 100, Input = " hi " }); - session.Save(new AnotherEntity { Id = 101, Input = "hi" }); - session.Save(new AnotherEntity { Id = 102, Input = "heh" }); + session.Save(new AnotherEntity { Input = " hi " }); + session.Save(new AnotherEntity { Input = "hi" }); + session.Save(new AnotherEntity { Input = "heh" }); + session.Flush(); Assert.AreEqual(2, session.Query<AnotherEntity>().Where(e => e.Input.Trim() == "hi").Count()); Assert.AreEqual(TestDialect.IgnoresTrailingWhitespace ? 2 : 1, session.Query<AnotherEntity>().Where(e => e.Input.TrimStart() == "hi ").Count()); @@ -139,7 +140,8 @@ } finally { - session.Delete("from AnotherEntity e where e.Id >= 100"); + session.Delete("from AnotherEntity e where e.Id > 5"); + session.Flush(); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pa...@us...> - 2011-06-04 15:13:20
|
Revision: 5906 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5906&view=rev Author: patearl Date: 2011-06-04 15:13:13 +0000 (Sat, 04 Jun 2011) Log Message: ----------- Tests: Fixed trim test for different id generators. Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/Linq/FunctionTests.cs Modified: trunk/nhibernate/src/NHibernate.Test/Linq/FunctionTests.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/Linq/FunctionTests.cs 2011-06-04 14:14:38 UTC (rev 5905) +++ trunk/nhibernate/src/NHibernate.Test/Linq/FunctionTests.cs 2011-06-04 15:13:13 UTC (rev 5906) @@ -1,4 +1,5 @@ using System.Linq; +using System.Collections.Generic; using NHibernate.DomainModel.Northwind.Entities; using NHibernate.Linq; using NUnit.Framework; @@ -122,11 +123,18 @@ [Test] public void Trim() { + List<int> idsToDelete = new List<int>(); try { - session.Save(new AnotherEntity { Input = " hi " }); - session.Save(new AnotherEntity { Input = "hi" }); - session.Save(new AnotherEntity { Input = "heh" }); + AnotherEntity ae1 = new AnotherEntity {Input = " hi "}; + AnotherEntity ae2 = new AnotherEntity {Input = "hi"}; + AnotherEntity ae3 = new AnotherEntity {Input = "heh"}; + session.Save(ae1); + idsToDelete.Add(ae1.Id); + session.Save(ae2); + idsToDelete.Add(ae2.Id); + session.Save(ae3); + idsToDelete.Add(ae3.Id); session.Flush(); Assert.AreEqual(2, session.Query<AnotherEntity>().Where(e => e.Input.Trim() == "hi").Count()); @@ -139,7 +147,8 @@ } finally { - session.Delete("from AnotherEntity e where e.Id > 5"); + foreach (int idToDelete in idsToDelete) + session.Delete(session.Get<AnotherEntity>(idToDelete)); session.Flush(); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |