AjErl.Tests.Expressions.MatchExpressionTests.RaiseIfMatchBoundVariableWithInteger C# (CSharp) Method

RaiseIfMatchBoundVariableWithInteger() private method

private RaiseIfMatchBoundVariableWithInteger ( ) : void
return void
        public void RaiseIfMatchBoundVariableWithInteger()
        {
            Context context = new Context();
            Variable variable = new Variable("X");
            context.SetValue("X", 1);
            MatchExpression expr = new MatchExpression(new VariableExpression(variable), new ConstantExpression(123));

            try
            {
                expr.Evaluate(context);
                Assert.Fail();
            }
            catch (Exception ex)
            {
                Assert.IsInstanceOfType(ex, typeof(InvalidOperationException));
                Assert.AreEqual("no match of right hand side value 123", ex.Message);
            }
        }