diff UnitTests/CS/Data/Linq/LinqTest.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/CS/Data/Linq/LinqTest.cs	Thu Mar 27 21:46:09 2014 +0400
@@ -0,0 +1,59 @@
+using System;
+using System.Linq;
+
+using NUnit.Framework;
+
+using BLToolkit.Data;
+using BLToolkit.Data.Linq;
+
+namespace Data.Linq
+{
+	using Model;
+
+	[TestFixture]
+	public class LinqTest
+	{
+		class TestManager : DbManager
+		{
+			public Table<Person> Person
+			{
+				get { return GetTable<Person>(); }
+			}
+		}
+
+		[Test]
+		public void Test()
+		{
+			using (TestManager db = new TestManager())
+			{
+				var query = db.Person.Select(p => p);
+
+				var list = query.ToList();
+			}
+		}
+
+		Func<int, int> f;
+
+		void Func(System.Linq.Expressions.Expression<Func<int, int>> func, int n)
+		{
+			if (f == null)
+				f = func.Compile();
+
+			n = f(n);
+
+			Console.WriteLine(n);
+		}
+
+		void Foo(int i)
+		{
+			Func((n) => n + 2, i);
+		}
+
+		[Test]
+		public void Test2()
+		{
+			Foo(0);
+			Foo(1);
+		}
+	}
+}