示例#1
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);
        }
示例#3
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);
        }
示例#4
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);
        }