public void GetCommand_OptionObject_GetErrorCode0_ReturnsGetErrorCode0Command()
        {
            // Arrange
            OptionObject         optionObject = new OptionObject();
            string               parameter    = "GetErrorCode0";
            GetErrorCode0Command expected     = new GetErrorCode0Command(optionObject.ToOptionObject2015());

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

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

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

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

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

            // Assert
            Assert.AreEqual(expected.GetType(), actual.GetType());
        }
Пример #4
0
        public void TransformToOptionObject2015_OptionObject_SystemCodeMatch()
        {
            OptionObject optionObject = new OptionObject();

            OptionObject2015 transformedOptionObject = optionObject.ToOptionObject2015();

            Assert.AreEqual(optionObject.SystemCode, transformedOptionObject.SystemCode);
        }
Пример #5
0
        public void TransformToOptionObject2015_OptionObject_OptionUserIdMatch()
        {
            OptionObject optionObject = new OptionObject();

            OptionObject2015 transformedOptionObject = optionObject.ToOptionObject2015();

            Assert.AreEqual(optionObject.OptionUserId, transformedOptionObject.OptionUserId);
        }
Пример #6
0
        public void TransformToOptionObject2015_OptionObject_FacilityMatch()
        {
            OptionObject optionObject = new OptionObject();

            OptionObject2015 transformedOptionObject = optionObject.ToOptionObject2015();

            Assert.AreEqual(optionObject.Facility, transformedOptionObject.Facility);
        }
Пример #7
0
        public void TransformToOptionObject2015_OptionObject_ErrorMesgMatch()
        {
            OptionObject optionObject = new OptionObject();

            OptionObject2015 transformedOptionObject = optionObject.ToOptionObject2015();

            Assert.AreEqual(optionObject.ErrorMesg, transformedOptionObject.ErrorMesg);
        }
Пример #8
0
        public void TransformToOptionObject2015_OptionObject_EpisodeNumberMatch()
        {
            OptionObject optionObject = new OptionObject();

            OptionObject2015 transformedOptionObject = optionObject.ToOptionObject2015();

            Assert.AreEqual(optionObject.EpisodeNumber, transformedOptionObject.EpisodeNumber);
        }
Пример #9
0
        public void TransformToOptionObject2015_OptionObject_EntityIdMatch()
        {
            OptionObject optionObject = new OptionObject();

            OptionObject2015 transformedOptionObject = optionObject.ToOptionObject2015();

            Assert.AreEqual(optionObject.EntityID, transformedOptionObject.EntityID);
        }
Пример #10
0
        public void TransformToOptionObject2015_OptionObject_FormCountMatch()
        {
            OptionObject optionObject = new OptionObject();

            OptionObject2015 transformedOptionObject = optionObject.ToOptionObject2015();

            Assert.AreEqual(optionObject.Forms.Count, transformedOptionObject.Forms.Count);
        }
        public OptionObject RunScript(OptionObject optionObject, string parameter)
        {
            IRunScriptCommand command = CommandFactory.GetCommand(optionObject.ToOptionObject2015(), parameter);

            if (command == null)
            {
                logger.Error("A valid RunScript command was not retrieved.");
                return(optionObject);
            }
            return(command.Execute().ToOptionObject());
        }
Пример #12
0
        public void TransformToOptionObject2015_OptionObject_ModifiedFormCountMatch()
        {
            FormObject   addForm      = new FormObject();
            OptionObject optionObject = new OptionObject();

            optionObject.Forms.Add(addForm);

            OptionObject2015 transformedOptionObject = optionObject.ToOptionObject2015();

            Assert.AreEqual(optionObject.Forms.Count, transformedOptionObject.Forms.Count);
        }
Пример #13
0
        public void RunScript_GetErrorCode1_OptionObject_FormCountEquals0()
        {
            // Arrange
            OptionObject optionObject = new OptionObject();
            var          command      = new GetErrorCode1Command(optionObject.ToOptionObject2015());

            // Act
            OptionObject returnOptionObject = command.Execute().ToOptionObject();

            // Assert
            Assert.AreEqual(0, returnOptionObject.Forms.Count);
        }
Пример #14
0
        public void RunScript_GetErrorCode1_OptionObject_ReturnsErrorCode0()
        {
            // Arrange
            OptionObject optionObject = new OptionObject();
            var          command      = new GetErrorCode1Command(optionObject.ToOptionObject2015());

            // Act
            OptionObject returnOptionObject = command.Execute().ToOptionObject();

            // Assert
            Assert.AreEqual(1, returnOptionObject.ErrorCode);
        }
        public void RunScript_DefaultScript_OptionObject_FormCountEquals0()
        {
            // Arrange
            OptionObject optionObject = new OptionObject();
            string       scriptName   = "?";
            var          command      = new DefaultScriptCommand(optionObject.ToOptionObject2015(), scriptName);

            // Act
            OptionObject returnOptionObject = command.Execute().ToOptionObject();

            // Assert
            Assert.AreEqual(0, returnOptionObject.Forms.Count);
        }
        public void RunScript_DefaultScript_OptionObject_ReturnsErrorCode0()
        {
            // Arrange
            OptionObject optionObject = new OptionObject();
            string       scriptName   = "?";
            var          command      = new DefaultScriptCommand(optionObject.ToOptionObject2015(), scriptName);

            // Act
            OptionObject returnOptionObject = command.Execute().ToOptionObject();

            // Assert
            Assert.AreEqual(3, returnOptionObject.ErrorCode);
        }
Пример #17
0
        public void RunScript_SetFieldValue_OptionObject_FormCountEquals1()
        {
            // Arrange
            FieldObject fieldObject = new FieldObject()
            {
                FieldNumber = "123",
                FieldValue  = "TESTING"
            };
            RowObject rowObject = new RowObject()
            {
                Fields = new List <FieldObject>()
                {
                    fieldObject
                },
                RowId = "1||1"
            };
            FormObject formObject = new FormObject()
            {
                CurrentRow = rowObject,
                FormId     = "1"
            };
            OptionObject optionObject = new OptionObject()
            {
                Forms = new List <FormObject>()
                {
                    formObject
                }
            };
            string parameter = "?";
            var    command   = new SetFieldValueCommand(optionObject.ToOptionObject2015(), parameter);

            // Act
            OptionObject returnOptionObject = command.Execute().ToOptionObject();

            // Assert
            Assert.AreEqual(1, returnOptionObject.Forms.Count);
        }
 public static OptionObject RunScript(OptionObject optionObject, string parameter)
 {
     return(RunScript(optionObject.ToOptionObject2015(), parameter).ToOptionObject());
 }
 public static OptionObject RunScript(OptionObject optionObject, string scriptName)
 {
     return(RunScript(optionObject.ToOptionObject2015(), scriptName).ToOptionObject());
 }
 public static OptionObject RunScript(OptionObject optionObject)
 {
     return(RunScript(optionObject.ToOptionObject2015()).ToOptionObject());
 }