public void GivenFunctionNotInExternalFile_Execute_Pythonscript_ShouldNotExecuteFunction() { var activity = new DsfScriptingActivity(); Assert.IsNotNull(activity); activity.Script = "return \"someValue\".endsWith(\"e\")"; activity.ScriptType = enScriptType.Python; activity.Execute(DataObject, 0); Assert.AreEqual(1, DataObject.Environment.Errors.Count); }
public void GivenExternalFile_Execute_Pythonscript_ShouldExecuteExternalFunction() { var activity = new DsfScriptingActivity(); Assert.IsNotNull(activity); activity.IncludeFile = GetPyTmpFile(); activity.Script = "return GreaterThanFive(10)"; activity.ScriptType = enScriptType.Python; activity.Execute(DataObject, 0); Assert.AreEqual(0, DataObject.Environment.Errors.Count); }
public void GivenExternalFile_Execute_Javascript_ShouldExecuteExternalFunction() { var activity = new DsfScriptingActivity(); Assert.IsNotNull(activity); activity.IncludeFile = GetJsTmpFile(); activity.Script = "return \"someValue\".endsWith(\"e\")"; activity.ScriptType = enScriptType.JavaScript; activity.Execute(DataObject, 0); Assert.AreEqual(0, DataObject.Environment.Errors.Count); }
public void DsfScriptingActivity_GivenInvalidScript_SholdReturnException() { var activity = new DsfScriptingActivity(); Assert.IsNotNull(activity); activity.IncludeFile = GetJsTmpFile(); activity.Script = "return \"someValue\".endsWith(\"e\")"; activity.ScriptType = enScriptType.JavaScript; activity.Execute(DataObject, 0); Assert.AreEqual(0, DataObject.Environment.Errors.Count); var debugInputs = activity.GetDebugInputs(DataObject.Environment, 0); Assert.IsNotNull(debugInputs); }
public void DsfScriptingActivity_ShouldReturnResults() { var activity = new DsfScriptingActivity(); Assert.IsNotNull(activity); activity.IncludeFile = GetJsTmpFile(); activity.Script = "return \"someValue\".endsWith(\"e\")"; activity.ScriptType = enScriptType.JavaScript; activity.Execute(DataObject, 0); Assert.AreEqual(0, DataObject.Environment.Errors.Count); var debugOutputs = activity.GetForEachOutputs(); Assert.IsNotNull(debugOutputs); }
public void DsfScriptingActivity_GivenInvalidScript_SholdUpdateForEachInputs() { var activity = new DsfScriptingActivity(); Assert.IsNotNull(activity); activity.IncludeFile = GetJsTmpFile(); const string script = "return \"someValue\".endsWith(\"e\")"; activity.Script = script; activity.ScriptType = enScriptType.JavaScript; activity.Execute(DataObject, 0); var tuple1 = new Tuple <string, string>(script, "Test"); activity.UpdateForEachInputs(new List <Tuple <string, string> > { tuple1 }); Assert.AreEqual(enScriptType.JavaScript, activity.ScriptType); }