diff UnitTests/Linq/MultipleQuery.cs @ 0:f990fcb411a9

Копия текущей версии из github
author cin
date Thu, 27 Mar 2014 21:46:09 +0400
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/UnitTests/Linq/MultipleQuery.cs	Thu Mar 27 21:46:09 2014 +0400
@@ -0,0 +1,72 @@
+using System;
+using System.Linq;
+
+using NUnit.Framework;
+
+namespace Data.Linq
+{
+	[TestFixture]
+	public class MultipleQuery : TestBase
+	{
+		//[Test]
+		public void Test1()
+		{
+			BLToolkit.Common.Configuration.Linq.AllowMultipleQuery = true;
+
+			ForEachProvider(db => AreEqual(
+				from p in    Parent select p.Children,
+				from p in db.Parent select p.Children));
+
+			BLToolkit.Common.Configuration.Linq.AllowMultipleQuery = false;
+		}
+
+		//[Test]
+		public void Test2()
+		{
+			BLToolkit.Common.Configuration.Linq.AllowMultipleQuery = true;
+
+			ForEachProvider(db => AreEqual(
+				from p in    Parent select p.Children.ToList(),
+				from p in db.Parent select p.Children.ToList()));
+
+			BLToolkit.Common.Configuration.Linq.AllowMultipleQuery = false;
+		}
+
+		[Test]
+		public void Test3()
+		{
+			ForEachProvider(db => AreEqual(
+				from p in    Parent select    Child,
+				from p in db.Parent select db.Child));
+		}
+
+		//[Test]
+		public void Test4()
+		{
+			BLToolkit.Common.Configuration.Linq.AllowMultipleQuery = true;
+
+			ForEachProvider(db => AreEqual(
+				from p in    Parent select p.Children.Select(c => c.ChildID),
+				from p in db.Parent select p.Children.Select(c => c.ChildID)));
+
+			BLToolkit.Common.Configuration.Linq.AllowMultipleQuery = false;
+		}
+
+		[Test]
+		public void Test5()
+		{
+			BLToolkit.Common.Configuration.Linq.AllowMultipleQuery = true;
+
+			ForEachProvider(db =>
+				AreEqual(
+					from ch in    Child
+					orderby ch.ChildID
+					select    Parent.Where(p => p.ParentID == ch.Parent.ParentID).Select(p => p),
+					from ch in db.Child
+					orderby ch.ChildID
+					select db.Parent.Where(p => p.ParentID == ch.Parent.ParentID).Select(p => p)));
+
+			BLToolkit.Common.Configuration.Linq.AllowMultipleQuery = false;
+		}
+	}
+}