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. |