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_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());
        }
示例#3
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());
        }
示例#4
0
        public void Execute_EnabledEmpty_ReturnsEnabledEmpty()
        {
            // Arrange
            FieldObject fieldObject = new FieldObject()
            {
                Enabled     = "",
                FieldNumber = "123",
                FieldValue  = "",
                Lock        = "",
                Required    = ""
            };
            RowObject rowObject = new RowObject()
            {
                Fields = new List <FieldObject>()
                {
                    fieldObject
                },
                RowId = "1||1"
            };
            FormObject formObject = new FormObject()
            {
                CurrentRow        = rowObject,
                FormId            = "1",
                MultipleIteration = false
            };
            OptionObject2015 optionObject2015 = new OptionObject2015()
            {
                Forms = new List <FormObject>()
                {
                    formObject
                }
            };
            IOptionObjectDecorator optionObjectDecorator = new OptionObjectDecorator(optionObject2015);
            IParameter             parameter             = new Parameter("SetFieldValue,123,New Field Value");
            string expected = "";
            var    command  = new SetFieldValueCommand(optionObjectDecorator, parameter);

            // Act
            OptionObject2015 optionObject = (OptionObject2015)command.Execute();
            string           actual       = optionObject.Forms[0].CurrentRow.Fields[0].Enabled;

            // Assert
            Assert.AreEqual(expected, actual);
        }
        public void RunScript_SetFieldValue_OptionObject2015_ReturnsErrorCode0()
        {
            // 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"
            };
            OptionObject2015 optionObject = new OptionObject2015()
            {
                Forms = new List <FormObject>()
                {
                    formObject
                }
            };
            IOptionObjectDecorator optionObjectDecorator = new OptionObjectDecorator(optionObject);
            IParameter             parameter             = new Parameter("SetFieldValue,123");
            var command = new SetFieldValueCommand(optionObjectDecorator, parameter);

            // Act
            OptionObject2015 returnOptionObject = (OptionObject2015)command.Execute();

            // Assert
            Assert.AreEqual(0, returnOptionObject.ErrorCode);
        }
示例#6
0
        public void RunScript_SetFieldValue_OptionObject2_ReturnsErrorCode0()
        {
            // 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"
            };
            OptionObject2 optionObject = new OptionObject2()
            {
                Forms = new List <FormObject>()
                {
                    formObject
                }
            };
            string parameter = "?";
            var    command   = new SetFieldValueCommand(optionObject.ToOptionObject2015(), parameter);

            // Act
            OptionObject2 returnOptionObject = command.Execute().ToOptionObject2();

            // Assert
            Assert.AreEqual(0, returnOptionObject.ErrorCode);
        }
示例#7
0
        public void RunScript_SetFieldValue_OptionObject2015_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"
            };
            OptionObject2015 optionObject = new OptionObject2015()
            {
                Forms = new List <FormObject>()
                {
                    formObject
                }
            };
            string parameter = "?";
            var    command   = new SetFieldValueCommand(optionObject, parameter);

            // Act
            OptionObject2015 returnOptionObject = command.Execute();

            // Assert
            Assert.AreEqual(1, returnOptionObject.Forms.Count);
        }