From: <pa...@us...> - 2011-01-16 20:48:58
|
Revision: 5353 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5353&view=rev Author: patearl Date: 2011-01-16 20:48:51 +0000 (Sun, 16 Jan 2011) Log Message: ----------- Moved Linq tests that examine specific methods into subfolder. Modified Paths: -------------- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Added Paths: ----------- trunk/nhibernate/src/NHibernate.Test/Linq/ByMethod/ trunk/nhibernate/src/NHibernate.Test/Linq/ByMethod/AnyTests.cs trunk/nhibernate/src/NHibernate.Test/Linq/ByMethod/OrderByTests.cs trunk/nhibernate/src/NHibernate.Test/Linq/ByMethod/SumTests.cs Removed Paths: ------------- trunk/nhibernate/src/NHibernate.Test/Linq/AnyTests.cs trunk/nhibernate/src/NHibernate.Test/Linq/OrderByTests.cs trunk/nhibernate/src/NHibernate.Test/Linq/SumTests.cs Deleted: trunk/nhibernate/src/NHibernate.Test/Linq/AnyTests.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/Linq/AnyTests.cs 2011-01-16 02:49:49 UTC (rev 5352) +++ trunk/nhibernate/src/NHibernate.Test/Linq/AnyTests.cs 2011-01-16 20:48:51 UTC (rev 5353) @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using NUnit.Framework; - -namespace NHibernate.Test.Linq -{ - [TestFixture] - public class AnyTests : LinqTestCase - { - [Test] - public void AnySublist() - { - var orders = db.Orders.Where(o => o.OrderLines.Any(ol => ol.Quantity == 5)).ToList(); - Assert.AreEqual(61, orders.Count); - } - } -} Added: trunk/nhibernate/src/NHibernate.Test/Linq/ByMethod/AnyTests.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/Linq/ByMethod/AnyTests.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/Linq/ByMethod/AnyTests.cs 2011-01-16 20:48:51 UTC (rev 5353) @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using NUnit.Framework; + +namespace NHibernate.Test.Linq.ByMethod +{ + [TestFixture] + public class AnyTests : LinqTestCase + { + [Test] + public void AnySublist() + { + var orders = db.Orders.Where(o => o.OrderLines.Any(ol => ol.Quantity == 5)).ToList(); + Assert.AreEqual(61, orders.Count); + } + } +} Copied: trunk/nhibernate/src/NHibernate.Test/Linq/ByMethod/OrderByTests.cs (from rev 5344, trunk/nhibernate/src/NHibernate.Test/Linq/OrderByTests.cs) =================================================================== --- trunk/nhibernate/src/NHibernate.Test/Linq/ByMethod/OrderByTests.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/Linq/ByMethod/OrderByTests.cs 2011-01-16 20:48:51 UTC (rev 5353) @@ -0,0 +1,119 @@ +using System.Linq; +using NUnit.Framework; + +namespace NHibernate.Test.Linq.ByMethod +{ + [TestFixture] + public class OrderByTests : LinqTestCase + { + [Test] + public void AscendingOrderByClause() + { + var query = from c in db.Customers + orderby c.CustomerId + select c.CustomerId; + + var ids = query.ToList(); + + if (ids.Count > 1) + { + Assert.Greater(ids[1], ids[0]); + } + } + + [Test] + public void DescendingOrderByClause() + { + var query = from c in db.Customers + orderby c.CustomerId descending + select c.CustomerId; + + var ids = query.ToList(); + + if (ids.Count > 1) + { + Assert.Greater(ids[0], ids[1]); + } + } + + [Test] + [Ignore("NHibernate does not currently support subqueries in select clause (no way to specify a projection from a detached criteria).")] + public void AggregateAscendingOrderByClause() + { + var query = from c in db.Customers + orderby c.Orders.Count + select c; + + var customers = query.ToList(); + + if (customers.Count > 1) + { + Assert.Less(customers[0].Orders.Count, customers[1].Orders.Count); + } + } + + [Test] + [Ignore("NHibernate does not currently support subqueries in select clause (no way to specify a projection from a detached criteria).")] + public void AggregateDescendingOrderByClause() + { + var query = from c in db.Customers + orderby c.Orders.Count descending + select c; + + var customers = query.ToList(); + + if (customers.Count > 1) + { + Assert.Greater(customers[0].Orders.Count, customers[1].Orders.Count); + } + } + + [Test] + public void ComplexAscendingOrderByClause() + { + var query = from c in db.Customers + where c.Address.Country == "Belgium" + orderby c.Address.Country, c.Address.City + select c.Address.City; + + var ids = query.ToList(); + + if (ids.Count > 1) + { + Assert.Greater(ids[1], ids[0]); + } + } + + [Test] + public void ComplexDescendingOrderByClause() + { + var query = from c in db.Customers + where c.Address.Country == "Belgium" + orderby c.Address.Country descending, c.Address.City descending + select c.Address.City; + + var ids = query.ToList(); + + if (ids.Count > 1) + { + Assert.Greater(ids[0], ids[1]); + } + } + + [Test] + public void ComplexAscendingDescendingOrderByClause() + { + var query = from c in db.Customers + where c.Address.Country == "Belgium" + orderby c.Address.Country ascending, c.Address.City descending + select c.Address.City; + + var ids = query.ToList(); + + if (ids.Count > 1) + { + Assert.Greater(ids[0], ids[1]); + } + } + } +} \ No newline at end of file Copied: trunk/nhibernate/src/NHibernate.Test/Linq/ByMethod/SumTests.cs (from rev 5344, trunk/nhibernate/src/NHibernate.Test/Linq/SumTests.cs) =================================================================== --- trunk/nhibernate/src/NHibernate.Test/Linq/ByMethod/SumTests.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/Linq/ByMethod/SumTests.cs 2011-01-16 20:48:51 UTC (rev 5353) @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using NUnit.Framework; + +namespace NHibernate.Test.Linq.ByMethod +{ + [TestFixture] + public class SumTests : LinqTestCase + { + [Test] + [ExpectedException] + public void EmptySumDecimal() + { + db.OrderLines.Where(ol => false).Sum(ol => ol.Discount); + } + + [Test] + public void EmptySumCastNullableDecimal() + { + decimal total = db.OrderLines.Where(ol => false).Sum(ol => (decimal?)ol.Discount) ?? 0; + Assert.AreEqual(0, total); + } + + [Test] + public void SumDecimal() + { + decimal total = db.OrderLines.Sum(ol => ol.Discount); + Assert.Greater(total, 0); + } + + [Test] + public void EmptySumNullableDecimal() + { + decimal total = db.Orders.Where(ol => false).Sum(ol => ol.Freight) ?? 0; + Assert.AreEqual(0, total); + } + + [Test] + public void SumNullableDecimal() + { + decimal? total = db.Orders.Sum(ol => ol.Freight); + Assert.Greater(total, 0); + } + } +} Deleted: trunk/nhibernate/src/NHibernate.Test/Linq/OrderByTests.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/Linq/OrderByTests.cs 2011-01-16 02:49:49 UTC (rev 5352) +++ trunk/nhibernate/src/NHibernate.Test/Linq/OrderByTests.cs 2011-01-16 20:48:51 UTC (rev 5353) @@ -1,119 +0,0 @@ -using System.Linq; -using NUnit.Framework; - -namespace NHibernate.Test.Linq -{ - [TestFixture] - public class OrderByTests : LinqTestCase - { - [Test] - public void AscendingOrderByClause() - { - var query = from c in db.Customers - orderby c.CustomerId - select c.CustomerId; - - var ids = query.ToList(); - - if (ids.Count > 1) - { - Assert.Greater(ids[1], ids[0]); - } - } - - [Test] - public void DescendingOrderByClause() - { - var query = from c in db.Customers - orderby c.CustomerId descending - select c.CustomerId; - - var ids = query.ToList(); - - if (ids.Count > 1) - { - Assert.Greater(ids[0], ids[1]); - } - } - - [Test] - [Ignore("NHibernate does not currently support subqueries in select clause (no way to specify a projection from a detached criteria).")] - public void AggregateAscendingOrderByClause() - { - var query = from c in db.Customers - orderby c.Orders.Count - select c; - - var customers = query.ToList(); - - if (customers.Count > 1) - { - Assert.Less(customers[0].Orders.Count, customers[1].Orders.Count); - } - } - - [Test] - [Ignore("NHibernate does not currently support subqueries in select clause (no way to specify a projection from a detached criteria).")] - public void AggregateDescendingOrderByClause() - { - var query = from c in db.Customers - orderby c.Orders.Count descending - select c; - - var customers = query.ToList(); - - if (customers.Count > 1) - { - Assert.Greater(customers[0].Orders.Count, customers[1].Orders.Count); - } - } - - [Test] - public void ComplexAscendingOrderByClause() - { - var query = from c in db.Customers - where c.Address.Country == "Belgium" - orderby c.Address.Country, c.Address.City - select c.Address.City; - - var ids = query.ToList(); - - if (ids.Count > 1) - { - Assert.Greater(ids[1], ids[0]); - } - } - - [Test] - public void ComplexDescendingOrderByClause() - { - var query = from c in db.Customers - where c.Address.Country == "Belgium" - orderby c.Address.Country descending, c.Address.City descending - select c.Address.City; - - var ids = query.ToList(); - - if (ids.Count > 1) - { - Assert.Greater(ids[0], ids[1]); - } - } - - [Test] - public void ComplexAscendingDescendingOrderByClause() - { - var query = from c in db.Customers - where c.Address.Country == "Belgium" - orderby c.Address.Country ascending, c.Address.City descending - select c.Address.City; - - var ids = query.ToList(); - - if (ids.Count > 1) - { - Assert.Greater(ids[0], ids[1]); - } - } - } -} \ No newline at end of file Deleted: trunk/nhibernate/src/NHibernate.Test/Linq/SumTests.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/Linq/SumTests.cs 2011-01-16 02:49:49 UTC (rev 5352) +++ trunk/nhibernate/src/NHibernate.Test/Linq/SumTests.cs 2011-01-16 20:48:51 UTC (rev 5353) @@ -1,47 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using NUnit.Framework; - -namespace NHibernate.Test.Linq -{ - [TestFixture] - public class SumTests : LinqTestCase - { - [Test] - [ExpectedException] - public void EmptySumDecimal() - { - db.OrderLines.Where(ol => false).Sum(ol => ol.Discount); - } - - [Test] - public void EmptySumCastNullableDecimal() - { - decimal total = db.OrderLines.Where(ol => false).Sum(ol => (decimal?)ol.Discount) ?? 0; - Assert.AreEqual(0, total); - } - - [Test] - public void SumDecimal() - { - decimal total = db.OrderLines.Sum(ol => ol.Discount); - Assert.Greater(total, 0); - } - - [Test] - public void EmptySumNullableDecimal() - { - decimal total = db.Orders.Where(ol => false).Sum(ol => ol.Freight) ?? 0; - Assert.AreEqual(0, total); - } - - [Test] - public void SumNullableDecimal() - { - decimal? total = db.Orders.Sum(ol => ol.Freight); - Assert.Greater(total, 0); - } - } -} Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2011-01-16 02:49:49 UTC (rev 5352) +++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2011-01-16 20:48:51 UTC (rev 5353) @@ -423,7 +423,7 @@ <Compile Include="LazyProperty\Book.cs" /> <Compile Include="LazyProperty\LazyPropertyFixture.cs" /> <Compile Include="Linq\AggregateTests.cs" /> - <Compile Include="Linq\AnyTests.cs" /> + <Compile Include="Linq\ByMethod\AnyTests.cs" /> <Compile Include="Linq\BinaryBooleanExpressionTests.cs" /> <Compile Include="Linq\BinaryExpressionOrdererTests.cs" /> <Compile Include="Linq\BooleanMethodExtensionExample.cs" /> @@ -445,7 +445,7 @@ <Compile Include="Linq\NorthwindDbCreator.cs" /> <Compile Include="Linq\NullComparisonTests.cs" /> <Compile Include="Linq\ObjectDumper.cs" /> - <Compile Include="Linq\OrderByTests.cs" /> + <Compile Include="Linq\ByMethod\OrderByTests.cs" /> <Compile Include="Linq\PagingTests.cs" /> <Compile Include="Linq\ParameterisedQueries.cs" /> <Compile Include="Linq\PatientTests.cs" /> @@ -455,7 +455,7 @@ <Compile Include="Linq\QueryReuseTests.cs" /> <Compile Include="Linq\ReadonlyTestCase.cs" /> <Compile Include="Linq\StatelessSessionQueringTest.cs" /> - <Compile Include="Linq\SumTests.cs" /> + <Compile Include="Linq\ByMethod\SumTests.cs" /> <Compile Include="Logging\Log4NetLoggerTest.cs" /> <Compile Include="Logging\LoggerProviderTest.cs" /> <Compile Include="NHSpecificTest\BagWithLazyExtraAndFilter\Domain.cs" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |