Explorar o código

tests for lift/liftToNull

svn path=/trunk/mcs/; revision=97380
Jb Evain %!s(int64=18) %!d(string=hai) anos
pai
achega
aa52bf1559

+ 12 - 1
mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_And.cs

@@ -123,7 +123,18 @@ namespace MonoTests.System.Linq.Expressions
 		}
 
 		[Test]
-		[Category ("NotWorking")]
+		public void AndLifted ()
+		{
+			var b = Expression.And (
+				Expression.Constant (null, typeof (bool?)),
+				Expression.Constant (null, typeof (bool?)));
+
+			Assert.AreEqual (typeof (bool?), b.Type);
+			Assert.IsTrue (b.IsLifted);
+			Assert.IsTrue (b.IsLiftedToNull);
+		}
+
+		[Test]
 		public void AndNullableTest ()
 		{
 			ParameterExpression a = Expression.Parameter (typeof (bool?), "a"), b = Expression.Parameter (typeof (bool?), "b");

+ 25 - 1
mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_AndAlso.cs

@@ -103,7 +103,7 @@ namespace MonoTests.System.Linq.Expressions
 		{
 			ParameterExpression a = Expression.Parameter (typeof (bool), "a"), b = Expression.Parameter (typeof (bool), "b");
 			var l = Expression.Lambda<Func<bool, bool, bool>> (
-				Expression.And (a, b), a, b);
+				Expression.AndAlso (a, b), a, b);
 
 			var be = l.Body as BinaryExpression;
 			Assert.IsNotNull (be);
@@ -119,6 +119,30 @@ namespace MonoTests.System.Linq.Expressions
 			Assert.AreEqual (false, c (false, false), "a4");
 		}
 
+		[Test]
+		public void AndAlsoLifted ()
+		{
+			var b = Expression.AndAlso (
+				Expression.Constant (null, typeof (bool?)),
+				Expression.Constant (null, typeof (bool?)));
+
+			Assert.AreEqual (typeof (bool?), b.Type);
+			Assert.IsTrue (b.IsLifted);
+			Assert.IsTrue (b.IsLiftedToNull);
+		}
+
+		[Test]
+		public void AndAlsoNotLifted ()
+		{
+			var b = Expression.AndAlso (
+				Expression.Constant (true, typeof (bool)),
+				Expression.Constant (true, typeof (bool)));
+
+			Assert.AreEqual (typeof (bool), b.Type);
+			Assert.IsFalse (b.IsLifted);
+			Assert.IsFalse (b.IsLiftedToNull);
+		}
+
 		[Test]
 		[Category ("NotWorking")]
 		public void AndAlsoTestNullable ()

+ 0 - 1
mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Or.cs

@@ -123,7 +123,6 @@ namespace MonoTests.System.Linq.Expressions
 		}
 
 		[Test]
-		[Category ("NotWorking")]
 		public void OrNullableTest ()
 		{
 			ParameterExpression a = Expression.Parameter (typeof (bool?), "a"), b = Expression.Parameter (typeof (bool?), "b");

+ 24 - 1
mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_OrElse.cs

@@ -128,6 +128,18 @@ namespace MonoTests.System.Linq.Expressions
 					   Expression.Constant (1));
 		}
 
+		[Test]
+		public void OrElseNotLifted ()
+		{
+			var b = Expression.OrElse (
+				Expression.Constant (true, typeof (bool)),
+				Expression.Constant (true, typeof (bool)));
+
+			Assert.AreEqual (typeof (bool), b.Type);
+			Assert.IsFalse (b.IsLifted);
+			Assert.IsFalse (b.IsLiftedToNull);
+		}
+
 		[Test]
 		public void OrElseTest ()
 		{
@@ -150,7 +162,18 @@ namespace MonoTests.System.Linq.Expressions
 		}
 
 		[Test]
-		[Category ("NotWorking")]
+		public void OrElseLifted ()
+		{
+			var b = Expression.OrElse (
+				Expression.Constant (null, typeof (bool?)),
+				Expression.Constant (null, typeof (bool?)));
+
+			Assert.AreEqual (typeof (bool?), b.Type);
+			Assert.IsTrue (b.IsLifted);
+			Assert.IsTrue (b.IsLiftedToNull);
+		}
+
+		[Test]
 		public void OrElseTestNullable ()
 		{
 			ParameterExpression a = Expression.Parameter (typeof (bool?), "a"), b = Expression.Parameter (typeof (bool?), "b");