Procházet zdrojové kódy

new test

svn path=/trunk/mcs/; revision=105106
Jb Evain před 17 roky
rodič
revize
fef94b0ff0

+ 20 - 0
mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Bind.cs

@@ -139,5 +139,25 @@ namespace MonoTests.System.Linq.Expressions
 			Assert.AreEqual (MemberClass.GetStaticPropertyInfo(), expr.Member, "Bind#16");
 		}
 
+		struct Slot {
+			public int Integer { get; set; }
+			public short Short { get; set; }
+		}
+
+		[Test]
+		[Category ("NotWorking")]
+		public void BindValueTypes ()
+		{
+			var i = Expression.Parameter (typeof (int), "i");
+			var s = Expression.Parameter (typeof (short), "s");
+
+			var gslot = Expression.Lambda<Func<int, short, Slot>> (
+				Expression.MemberInit (
+					Expression.New (typeof (Slot)),
+					Expression.Bind (typeof (Slot).GetProperty ("Integer"), i),
+					Expression.Bind (typeof (Slot).GetProperty ("Short"), s)), i, s).Compile ();
+
+			Assert.AreEqual (new Slot { Integer = 42, Short = -1 }, gslot (42, -1));
+		}
 	}
 }