public static void VariableCheck(ScriptRunner scriptRunner, string variableName, object value, Type variableType) { Assert.IsTrue(scriptRunner.Variables.ContainsKey(variableName)); VarBase variable = scriptRunner.Variables[variableName]; Assert.NotNull(variable); Assert.AreEqual(variableType, variable.GetType()); switch (variable) { case VarString varString: Assert.AreEqual((string)value, varString.Value); break; case VarBoolean varBoolean: Assert.AreEqual((bool)value, varBoolean.Value); break; case VarNumber varNumber: Assert.AreEqual((double)value, varNumber.Value); break; } }
public override VarBase Execute() { if (ContextToExecute == null) { VarBase first = First.Execute(); VarBase second = Second.Execute(); return(Operations.FindBest(first.GetType(), second.GetType(), OperationString).Compile()(first, second)); } return(ContextToExecute.Execute()); }