Пример #1
0
        public void RunScriptAPlusB()
        {
            // Arrange
            ActScript v = new ActScript();

            v.ScriptInterpreterType = ActScript.eScriptInterpreterType.VBS;
            v.AddNewReturnParams    = true;
            v.ScriptCommand         = ActScript.eScriptAct.Script;
            v.AddOrUpdateInputParamCalculatedValue("p1", "5");
            v.AddOrUpdateInputParamCalculatedValue("p2", "7");

            v.ScriptName = "APlusB.vbs";
            v.ScriptPath = TestResources.GetTestResourcesFolder("");

            //Act
            v.Execute();

            //Assert
            Assert.AreEqual(v.Error, null);
            Assert.AreEqual(v.ReturnValues[0].Param, "TXT");
            Assert.AreEqual(v.ReturnValues[0].Actual, "5 + 7 = 12");

            Assert.AreEqual(v.ReturnValues[1].Param, "Total");
            Assert.AreEqual(v.ReturnValues[1].Actual, "12");
        }
Пример #2
0
        public void RunScriptAPlusBBAT()
        {
            if (!isOSWindows)
            {
                return;
            }
            // Arrange
            ActScript v = new ActScript();

            v.ScriptInterpreterType = ActScript.eScriptInterpreterType.BAT;
            v.AddNewReturnParams    = true;
            v.ScriptCommand         = ActScript.eScriptAct.Script;
            v.AddOrUpdateInputParamCalculatedValue("p1", "5");
            v.AddOrUpdateInputParamCalculatedValue("p2", "7");

            v.ScriptName = "BatchScriptWithArgs.bat";
            v.ScriptPath = TestResources.GetTestResourcesFolder("Files");

            //Act
            v.Execute();

            //Assert
            Assert.AreEqual(v.Error, null);

            Assert.AreEqual(v.ReturnValues[0].Param, "Result");
            Assert.AreEqual(v.ReturnValues[0].Actual, "12");
        }
Пример #3
0
        public void FreeCommandVBS()
        {
            ActScript v = new ActScript();

            v.ScriptInterpreterType = ActScript.eScriptInterpreterType.VBS;
            v.ScriptCommand         = ActScript.eScriptAct.FreeCommand;
            v.AddNewReturnParams    = true;
            v.AddOrUpdateInputParamCalculatedValue("Free Command", "NumberB=10\r\nNumberA=20\r\nDim Result\r\nResult= int(NumberA) + int(NumberB)\r\nWscript.Echo \"Add=\" & Result");

            v.Execute();

            Assert.AreEqual(v.Error, null);
            Assert.AreEqual(v.ReturnValues[0].Actual.Contains("Add=30"), true);
        }
Пример #4
0
        [TestMethod]  //[Timeout(60000)]
        public void FreeCommandBAT()
        {
            // Arrange
            ActScript v = new ActScript();

            v.ScriptInterpreterType = ActScript.eScriptInterpreterType.BAT;
            v.ScriptCommand         = ActScript.eScriptAct.FreeCommand;
            v.AddNewReturnParams    = true;
            v.AddOrUpdateInputParamCalculatedValue("Free Command", "@echo off \r\nSET /A a = 5 \r\nSET /A b = 10 \r\nSET /A c = %a% + %b% \r\necho Add=%c% ");

            //Act
            v.Execute();

            //Assert
            Assert.AreEqual(v.Error, null);
            Assert.AreEqual(v.ReturnValues[0].Actual.Contains("Add=15"), true);
        }