public OptionObject2015 RunScript(OptionObject2015 optionObject, string parameter)
        {
            IRunScriptCommand command = CommandFactory.GetCommand(optionObject, parameter);

            if (command == null)
            {
                logger.Error("A valid RunScript command was not retrieved.");
                return(optionObject);
            }
            return(command.Execute());
        }
        public OptionObject RunScript(OptionObject optionObject, string parameterString)
        {
            IParameter        parameter = new Parameter(parameterString);
            IRunScriptCommand command   = CommandFactory.GetCommand(optionObject, parameter);

            if (command == null)
            {
                logger.Error("A valid RunScript command was not retrieved.");
                return(optionObject);
            }
            return((OptionObject)command.Execute());
        }
        public void GetCommand_OptionObject2015_GetErrorCode0_ReturnsGetErrorCode0Command()
        {
            // Arrange
            OptionObject2015     optionObject = new OptionObject2015();
            string               parameter    = "GetErrorCode0";
            GetErrorCode0Command expected     = new GetErrorCode0Command(optionObject);

            // Act
            IRunScriptCommand actual = CommandFactory.GetCommand(optionObject, parameter);

            // Assert
            Assert.AreEqual(expected.GetType(), actual.GetType());
        }
        public void GetCommand_OptionObject2015_SetFieldValue_ReturnsSetFieldValueCommand()
        {
            // Arrange
            OptionObject2015     optionObject = new OptionObject2015();
            string               parameter    = "SetFieldValue,123";
            SetFieldValueCommand expected     = new SetFieldValueCommand(optionObject, parameter);

            // Act
            IRunScriptCommand actual = CommandFactory.GetCommand(optionObject, parameter);

            // Assert
            Assert.AreEqual(expected.GetType(), actual.GetType());
        }
        public void GetCommand_OptionObject2015_EmptyParameter_ReturnsDefaultScriptCommand()
        {
            // Arrange
            OptionObject2015     optionObject = new OptionObject2015();
            string               parameter    = "";
            DefaultScriptCommand expected     = new DefaultScriptCommand(optionObject, parameter);

            // Act
            IRunScriptCommand actual = CommandFactory.GetCommand(optionObject, parameter);

            // Assert
            Assert.AreEqual(expected.GetType(), actual.GetType());
        }
        public void GetCommand_SetFieldValue_ReturnsSetFieldValueCommand()
        {
            // Arrange
            OptionObject2015       optionObject2015      = new OptionObject2015();
            IOptionObjectDecorator optionObjectDecorator = new OptionObjectDecorator(optionObject2015);
            IParameter             parameter             = new Parameter("SetFieldValue");
            SetFieldValueCommand   expected = new SetFieldValueCommand(optionObjectDecorator, parameter);

            // Act
            IRunScriptCommand actual = CommandSelector.GetCommand(optionObject2015, parameter);

            // Assert
            Assert.AreEqual(expected.GetType(), actual.GetType());
        }
        public void GetCommand_HelloWorld_ReturnsHelloWorldCommand()
        {
            // Arrange
            OptionObject2015       optionObject2015      = new OptionObject2015();
            IOptionObjectDecorator optionObjectDecorator = new OptionObjectDecorator(optionObject2015);
            IParameter             parameter             = new Parameter("HelloWorld");
            HelloWorldCommand      expected = new HelloWorldCommand(optionObjectDecorator);

            // Act
            IRunScriptCommand actual = CommandSelector.GetCommand(optionObject2015, parameter);

            // Assert
            Assert.AreEqual(expected.GetType(), actual.GetType());
        }
        public void GetCommand_EmptyParameter_ReturnsDefaultCommand()
        {
            // Arrange
            OptionObject2015       optionObject2015      = new OptionObject2015();
            IOptionObjectDecorator optionObjectDecorator = new OptionObjectDecorator(optionObject2015);
            IParameter             parameter             = new Parameter("");
            DefaultCommand         expected = new DefaultCommand(optionObjectDecorator, parameter);

            // Act
            IRunScriptCommand actual = CommandSelector.GetCommand(optionObject2015, parameter);

            // Assert
            Assert.AreEqual(expected.GetType(), actual.GetType());
        }
Exemple #9
0
        public void GetCommand_OptionObject2_GetErrorCode0_ReturnsGetErrorCode0Command()
        {
            // Arrange
            OptionObject2          optionObject          = new OptionObject2();
            IParameter             parameter             = new Parameter("GetErrorCode0");
            IOptionObjectDecorator optionObjectDecorator = new OptionObjectDecorator(optionObject);
            GetErrorCode0Command   expected = new GetErrorCode0Command(optionObjectDecorator);

            // Act
            IRunScriptCommand actual = CommandFactory.GetCommand(optionObject, parameter);

            // Assert
            Assert.AreEqual(expected.GetType(), actual.GetType());
        }
Exemple #10
0
        public void GetCommand_OptionObject2_SetFieldValue_ReturnsSetFieldValueCommand()
        {
            // Arrange
            OptionObject2          optionObject          = new OptionObject2();
            IParameter             parameter             = new Parameter("SetFieldValue,123");
            IOptionObjectDecorator optionObjectDecorator = new OptionObjectDecorator(optionObject);
            SetFieldValueCommand   expected = new SetFieldValueCommand(optionObjectDecorator, parameter);

            // Act
            IRunScriptCommand actual = CommandFactory.GetCommand(optionObject, parameter);

            // Assert
            Assert.AreEqual(expected.GetType(), actual.GetType());
        }
        public void GetCommand_SendEmail_ReturnsSendEmailCommand()
        {
            // Arrange
            OptionObject2015       optionObject2015      = new OptionObject2015();
            IOptionObjectDecorator optionObjectDecorator = new OptionObjectDecorator(optionObject2015);
            IParameter             parameter             = new Parameter("SendEmail");
            var smtpService           = new SmtpService();
            SendEmailCommand expected = new SendEmailCommand(optionObjectDecorator, smtpService);

            // Act
            IRunScriptCommand actual = CommandSelector.GetCommand(optionObject2015, parameter);

            // Assert
            Assert.AreEqual(expected.GetType(), actual.GetType());
        }
        public void GetCommand_GetOdbcData_ReturnsGetOdbcDataCommand()
        {
            // Arrange
            OptionObject2015           optionObject2015           = new OptionObject2015();
            IOptionObjectDecorator     optionObjectDecorator      = new OptionObjectDecorator(optionObject2015);
            IParameter                 parameter                  = new Parameter("GetOdbcData");
            ConnectionStringCollection connectionStringCollection = new ConnectionStringCollection("", "", "");
            var repository = new GetOdbcDataRepository(connectionStringCollection);
            GetOdbcDataCommand expected = new GetOdbcDataCommand(optionObjectDecorator, repository);

            // Act
            IRunScriptCommand actual = CommandSelector.GetCommand(optionObject2015, parameter);

            // Assert
            Assert.AreEqual(expected.GetType(), actual.GetType());
        }