Assert.AreEqual (0, negate (0));
Assert.AreEqual (3, negate (-3));
}
+
+ [Test]
+ [Category ("NotWorking")]
+ public void CompiledNegateNullableInt32 ()
+ {
+ var p = Expression.Parameter (typeof (int?), "i");
+ var negate = Expression.Lambda<Func<int?, int?>> (Expression.Negate (p), p).Compile ();
+
+ Assert.AreEqual (null, negate (null));
+ Assert.AreEqual ((int?) -2, negate (2));
+ Assert.AreEqual ((int?) 0, negate (0));
+ Assert.AreEqual ((int?) 3, negate (-3));
+ }
}
}
Assert.AreEqual (2, not (-3));
}
+ [Test]
+ [Category ("NotWorking")]
+ public void CompiledNotNullableInt32 ()
+ {
+ var p = Expression.Parameter (typeof (int?), "i");
+ var not = Expression.Lambda<Func<int?, int?>> (Expression.Not (p), p).Compile ();
+
+ Assert.AreEqual (null, not (null));
+ Assert.AreEqual ((int?) -4, not (3));
+ Assert.AreEqual ((int?) 2, not (-3));
+ }
+
[Test]
public void CompileNotBool ()
{
Assert.AreEqual (false, not (true));
Assert.AreEqual (true, not (false));
}
+
+ [Test]
+ [Category ("NotWorking")]
+ public void CompiledNotNullableBool ()
+ {
+ var p = Expression.Parameter (typeof (bool?), "i");
+ var not = Expression.Lambda<Func<bool?, bool?>> (Expression.Not (p), p).Compile ();
+
+ Assert.AreEqual ((bool?) null, not (null));
+ Assert.AreEqual ((bool?) false, not (true));
+ Assert.AreEqual ((bool?) true, not (false));
+ }
}
}