public void PlusOperatorThrows() { Operator op = new PlusOperator().Plus; MeVariable[] arr = { new MeString("test"), new MeNumber(10) }; Assert.IsFalse(op.CanExecute(arr)); TestUtils.CustomExceptionTest(() => op.Execute(arr), typeof(MeContextException)); }
public void PlusOperatorCanAdd() { Operator op = new PlusOperator().Plus; MeVariable[] arr = { new MeNumber(10), new MeNumber(20) }; Assert.IsTrue(op.CanExecute(arr)); const float expected = 30.0f; float result = op.Execute(arr).Get <float>(); Assert.AreEqual(expected, result); }