public void RunScript_DefaultScript_OptionObject2015_FormCountEquals0()
        {
            // Arrange
            OptionObject2015 optionObject = new OptionObject2015();
            string           scriptName   = "?";

            // Act
            OptionObject2015 returnOptionObject = DefaultScript.RunScript(optionObject, scriptName);

            // Assert
            Assert.AreEqual(0, returnOptionObject.Forms.Count);
        }
        public void RunScript_DefaultScript_OptionObject2015_ReturnsErrorCode0()
        {
            // Arrange
            OptionObject2015 optionObject = new OptionObject2015();
            string           scriptName   = "?";

            // Act
            OptionObject2015 returnOptionObject = DefaultScript.RunScript(optionObject, scriptName);

            // Assert
            Assert.AreEqual(3, returnOptionObject.ErrorCode);
        }
Ejemplo n.º 3
0
        public OptionObject RunScript(OptionObject optionObject, string parameter)
        {
            OptionObject returnOptionObject = new OptionObject();
            string       scriptName         = parameter != null?parameter.Split(',')[0] : "";

            logger.Debug("Script '" + scriptName + "' requested.");

            switch (scriptName)
            {
            case "GetErrorCode0":
                returnOptionObject = GetErrorCode0.RunScript(optionObject);
                logger.Debug("Script '" + scriptName + "' returned.");
                break;

            case "GetErrorCode1":
                returnOptionObject = GetErrorCode1.RunScript(optionObject);
                logger.Debug("Script '" + scriptName + "' returned.");
                break;

            case "GetErrorCode2":
                returnOptionObject = GetErrorCode2.RunScript(optionObject);
                logger.Debug("Script '" + scriptName + "' returned.");
                break;

            case "GetErrorCode3":
                returnOptionObject = GetErrorCode3.RunScript(optionObject);
                logger.Debug("Script '" + scriptName + "' returned.");
                break;

            case "GetErrorCode4":
                returnOptionObject = GetErrorCode4.RunScript(optionObject);
                logger.Debug("Script '" + scriptName + "' returned.");
                break;

            case "GetErrorCode5":
                returnOptionObject = GetErrorCode5.RunScript(optionObject);
                logger.Debug("Script '" + scriptName + "' returned.");
                break;

            case "GetErrorCode6":
                returnOptionObject = GetErrorCode6.RunScript(optionObject);
                logger.Debug("Script '" + scriptName + "' returned.");
                break;

            case "GetFieldValue":
                returnOptionObject = GetFieldValue.RunScript(optionObject, parameter);
                logger.Debug("Script '" + scriptName + "' returned.");
                break;

            case "SetFieldValue":
                returnOptionObject = SetFieldValue.RunScript(optionObject, parameter);
                logger.Debug("Script '" + scriptName + "' returned.");
                break;

            default:
                logger.Warn("ScriptName '" + scriptName + "' does not match an existing script.");
                returnOptionObject = DefaultScript.RunScript(optionObject, scriptName);
                break;
            }

            return(returnOptionObject);
        }