コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        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);
        }