Ejemplo n.º 1
0
        public void UnboundParameterException_ThrowIfOpen_Negative()
        {
            var f = (Expression <Func <int, int> >)(x => x + 1);

            UnboundParameterException.ThrowIfOpen(f, "Oops");

            Assert.IsTrue(true);
        }
Ejemplo n.º 2
0
        public void UnboundParameterException_ThrowIfOpen_Positive()
        {
            var f = (Expression <Func <int, int> >)(x => x + 1);

            AssertEx.ThrowsException <UnboundParameterException>(() => UnboundParameterException.ThrowIfOpen(f.Body, "Oops"), ex =>
            {
                Assert.AreSame(f.Body, ex.Expression);
                Assert.IsTrue(f.Parameters.SequenceEqual(ex.Parameters));
            });
        }
Ejemplo n.º 3
0
 public void UnboundParameterException_ArgumentChecking()
 {
     AssertEx.ThrowsException <ArgumentNullException>(() => new UnboundParameterException("", expression: null, Array.Empty <ParameterExpression>()), ex => Assert.AreEqual("expression", ex.ParamName));
     AssertEx.ThrowsException <ArgumentNullException>(() => new UnboundParameterException("", Expression.Constant(42), parameters: null), ex => Assert.AreEqual("parameters", ex.ParamName));
     AssertEx.ThrowsException <ArgumentNullException>(() => UnboundParameterException.ThrowIfOpen(expression: null, ""), ex => Assert.AreEqual("expression", ex.ParamName));
 }
Ejemplo n.º 4
0
 private static void CheckOpenParameters(Expression expression)
 {
     UnboundParameterException.ThrowIfOpen(expression, "The specified expression contains unbound parameters and cannot be funcletized or evaluated.");
 }