AsyncPoco.Tests.Tests.Page_Distinct C# (CSharp) Method

Page_Distinct() private method

private Page_Distinct ( ) : System.Threading.Tasks.Task
return System.Threading.Tasks.Task
		public async Task Page_Distinct()
		{
			// Unordered paging not supported by Compact Edition
			if (_connectionStringName == "sqlserverce")
				return;
			// In this test we're checking that the page count is correct when there are
			// not-exactly pagesize*N records (ie: a partial page at the end)

			// Create some records
			const int count = 13;
			long id = await InsertRecordsAsync(count);

			// Fetch em
			var r = await db.PageAsync<poco>(2, 5, "SELECT DISTINCT id from petapoco ORDER BY id");

			// Check em
			int i = 0;
			foreach (var p in r.Items)
			{
				Assert.AreEqual(p.id, id + i + 5);
				i++;
			}

			// Check other stats
			Assert.AreEqual(r.Items.Count, 5);
			Assert.AreEqual(r.CurrentPage, 2);
			Assert.AreEqual(r.ItemsPerPage, 5);
			Assert.AreEqual(r.TotalItems, 13);
			Assert.AreEqual(r.TotalPages, 3);
		}