static private GetNew ( ) : |
||
Résultat |
public void WhileLoopTests() { var processor = ScriptProcessorFactory.GetNew(); var result = processor.Run("var a = 0; while (a < 10) { a++; } a;"); Assert.IsTrue(result is SNumber); Assert.AreEqual(((SNumber)result).Value, 10); }
public void NotEqualsTests() { SObject result = null; var processor = ScriptProcessorFactory.GetNew(); result = processor.Run("2 != 3"); Assert.IsTrue(result is SBool); Assert.AreEqual(((SBool)result).Value, true); result = processor.Run("2 !== 3"); Assert.IsTrue(result is SBool); Assert.AreEqual(((SBool)result).Value, true); }
public void SmallerThanTests() { SObject result = null; var processor = ScriptProcessorFactory.GetNew(); result = processor.Run("2 < 3"); Assert.IsTrue(result is SBool); Assert.AreEqual(((SBool)result).Value, true); result = processor.Run("3 < -5"); Assert.IsTrue(result is SBool); Assert.AreEqual(((SBool)result).Value, false); result = processor.Run("\"test\" < -5"); Assert.IsTrue(result is SBool); Assert.AreEqual(((SBool)result).Value, false); }
public void GreaterThanOrEqualsTests() { SObject result = null; var processor = ScriptProcessorFactory.GetNew(); result = processor.Run("3 >= 2"); Assert.IsTrue(result is SBool); Assert.AreEqual(((SBool)result).Value, true); result = processor.Run("3 >= 3"); Assert.IsTrue(result is SBool); Assert.AreEqual(((SBool)result).Value, true); result = processor.Run("\"test\" >= 0"); Assert.IsTrue(result is SBool); Assert.AreEqual(((SBool)result).Value, false); }