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

RaiseIfMatchVariableInTupleWithTwoDifferentValues() private method

private RaiseIfMatchVariableInTupleWithTwoDifferentValues ( ) : void
return void
        public void RaiseIfMatchVariableInTupleWithTwoDifferentValues()
        {
            Context context = new Context();
            Variable x = new Variable("X");

            MatchExpression expr = new MatchExpression(new TupleExpression(new IExpression[] { new VariableExpression(x), new VariableExpression(x) }), new TupleExpression(new IExpression[] { new ConstantExpression(1), new ConstantExpression(2) }));

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