<commit_before>using System.Linq;
using NUnit.Framework;

namespace NHibernate.Test.Linq
{
	[TestFixture]
	public class PagingTests : LinqTestCase
	{
		[Test]
		public void Customers1to5()
		{
			var q = (from c in db.Customers select c.CustomerId).Take(5);
			var query = q.ToList();

			Assert.AreEqual(5, query.Count);
		}

		[Test]
		public void Customers11to20()
		{
			var query = (from c in db.Customers
						 orderby c.CustomerId
						 select c.CustomerId).Skip(10).Take(10).ToList();
			Assert.AreEqual(query[0], "BSBEV");
			Assert.AreEqual(10, query.Count);
		}

		[Test]
		[Ignore("Multiple Takes (or Skips) not handled correctly")]
		public void CustomersChainedTake()
		{
			var q = (from c in db.Customers
					 orderby c.CustomerId
					 select c.CustomerId).Take(5).Take(6);
			
			var query = q.ToList();

			Assert.AreEqual(5, query.Count);<commit_msg>Add test to ensure that Skip/Take does not over-cache queries.<commit_after>using System.Linq;
using NUnit.Framework;

namespace NHibernate.Test.Linq
{
	[TestFixture]
	public class PagingTests : LinqTestCase
	{
		[Test]
		public void Customers1to5()
		{
			var q = (from c in db.Customers select c.CustomerId).Take(5);
			var query = q.ToList();

			Assert.AreEqual(5, query.Count);
		}

		[Test]
		public void Customers11to20()
		{
			var query = (from c in db.Customers
						 orderby c.CustomerId
						 select c.CustomerId).Skip(10).Take(10).ToList();
			Assert.AreEqual(query[0], "BSBEV");
			Assert.AreEqual(10, query.Count);
		}

		[Test]
		public void Customers11to20And21to30ShouldNoCacheQuery()
		{
			var query = (from c in db.Customers
							orderby c.CustomerId
							select c.CustomerId).Skip(10).Take(10).ToList();
			Assert.AreEqual(query[0], "BSBEV");
			Assert.AreEqual(10, query.Count);

			query = (from c in db.Customers
						orderby c.CustomerId
						select c.CustomerId).Skip(20).Take(10).ToList();
			Assert.AreNotEqual(query[0], "BSBEV");
			Assert.AreEqual(10, query.Count);

			query = (from c in db.Customers
						orderby c.CustomerId
						select c.CustomerId).Skip(10).Take(20).ToList();
			Assert.AreEqual(query[0], "BSBEV");
			Assert.AreEqual(20, query.Count);
		}

		[Test]
		[Ignore("Multiple Takes (or Skips) not handled correctly")]
		public void CustomersChainedTake()
		{
			var q = (from c in db.Customers
					 orderby c.CustomerId
					 select c.CustomerId).Take(5).Take(6);
			
			var query = q.ToList();

			Assert.AreEqual(5, query.Count);
{'fraction_non_alphanumeric': 0.13403736799350122, 'fraction_numerical': 0.026401299756295696, 'mean_word_length': 3.35929203539823, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2964599', 'n_tokens_mistral': 1053, 'n_tokens_neox': 847, 'n_words': 196}