public void ParseHostedInvocation() { IExpression expression = ParseExpression("at host function(x,y) {return x+y;} with (1,2)"); Assert.IsNotNull(expression); Assert.IsInstanceOfType(expression, typeof(HostedInvocationExpression)); HostedInvocationExpression hexpr = (HostedInvocationExpression)expression; Assert.IsInstanceOfType(hexpr.HostExpression, typeof(VariableExpression)); Assert.AreEqual(2, hexpr.Arguments.Count); }
public void ParseHostedInvocationAsCommand() { ICommand command = ParseCommand("at host function(x,y) {return x+y;} with (1,2);"); Assert.IsNotNull(command); Assert.IsInstanceOfType(command, typeof(ExpressionCommand)); ExpressionCommand expcmd = (ExpressionCommand)command; Assert.IsInstanceOfType(expcmd.Expression, typeof(HostedInvocationExpression)); HostedInvocationExpression hexpr = (HostedInvocationExpression)expcmd.Expression; Assert.IsInstanceOfType(hexpr.HostExpression, typeof(VariableExpression)); Assert.AreEqual(2, hexpr.Arguments.Count); }