예제 #1
0
        public void DeleteRowObject_Helper_FromOptionObject_Null()
        {
            OptionObject optionObject = null;

            ScriptLinkHelpers.DeleteRowObject(optionObject, "1||1");
            Assert.IsFalse(optionObject.IsFieldPresent("1||1"));
        }
        public void IsFieldPresent_OptionObject_Null()
        {
            string       fieldNumber  = "123";
            OptionObject optionObject = null;

            Assert.IsFalse(optionObject.IsFieldPresent(fieldNumber));
        }
예제 #3
0
        public void DeleteRowObject_FromOptionObject_Null()
        {
            OptionObject optionObject = null;

            optionObject.DeleteRowObject("1||1");
            Assert.IsFalse(optionObject.IsFieldPresent("1||1"));
        }
예제 #4
0
        public void RemoveUneditedRows_OptionObject_UnmodifiedFieldIsAbsent()
        {
            // Arrange
            FieldObject fieldObject01 = new FieldObject("123", "");
            FieldObject fieldObject02 = new FieldObject("124", "");
            FieldObject fieldObject03 = new FieldObject("125", "");
            RowObject   rowObject01   = new RowObject("1||1", new List <FieldObject>()
            {
                fieldObject01, fieldObject02, fieldObject03
            });
            FormObject   formObject   = new FormObject("1", rowObject01);
            OptionObject optionObject = new OptionObject()
            {
                Forms = new List <FormObject>()
                {
                    formObject
                }
            };

            // Act
            optionObject.SetFieldValue("123", "MODIFIED");
            optionObject = (OptionObject)OptionObjectHelpers.RemoveUneditedRows(optionObject);

            // Assert
            Assert.IsFalse(optionObject.IsFieldPresent("124"));
        }
        public void DeleteRowObject_OptionObjectHelpers_OptionObject_Null_RowId_Error()
        {
            OptionObject optionObject = null;

            OptionObjectHelpers.DeleteRowObject(optionObject, "1||1");

            Assert.IsFalse(optionObject.IsFieldPresent("1||1"));
        }
        public void DeleteRowObject_OptionObjectHelpers_OptionObject_RowObject_Null_Error()
        {
            RowObject    rowObject    = null;
            OptionObject optionObject = new OptionObject();

            OptionObjectHelpers.DeleteRowObject(optionObject, rowObject);

            Assert.IsFalse(optionObject.IsFieldPresent("1||1"));
        }
        public void IsFieldPresent_OptionObject_FirstForm_IsPresent()
        {
            string    fieldNumber = "123";
            RowObject rowObject   = new RowObject();

            rowObject.AddFieldObject(new FieldObject(fieldNumber, "", true, false, false));
            FormObject formObject = new FormObject("1");

            formObject.AddRowObject(rowObject);
            OptionObject optionObject = new OptionObject();

            optionObject.AddFormObject(formObject);
            Assert.IsTrue(optionObject.IsFieldPresent(fieldNumber));
        }
        public static OptionObject RunScript(OptionObject optionObject, string parameter)
        {
            string[] parameters    = parameter.Split(',');
            string   fieldNumber   = parameters.Length >= 2 ? parameters[1] : "";
            string   returnMessage = "The FieldValue is ";

            if (optionObject.IsFieldPresent(fieldNumber))
            {
                returnMessage += optionObject.GetFieldValue(fieldNumber);
            }

            returnMessage += ". Since no FieldObjects were modified, no Forms should be returned.";

            return(optionObject.ToReturnOptionObject(ErrorCode.Informational, returnMessage));
        }
        public void IsFieldPresent_OptionObject_IsNotPresent()
        {
            string    fieldNumber = "123";
            RowObject rowObject   = new RowObject();

            rowObject.AddFieldObject(new FieldObject(fieldNumber, "", false, false, false));
            FormObject formObject1 = new FormObject("1");
            FormObject formObject2 = new FormObject("2");

            formObject2.AddRowObject(rowObject);
            OptionObject optionObject = new OptionObject();

            optionObject.AddFormObject(formObject1);
            optionObject.AddFormObject(formObject2);
            Assert.IsFalse(optionObject.IsFieldPresent("234"));
        }
 public static OptionObject RunScript(OptionObject optionObject, string parameter)
 {
     if (optionObject.IsFieldPresent("123"))
     {
         string fieldValue = optionObject.GetFieldValue("123");
         if (string.IsNullOrEmpty(fieldValue))
         {
             fieldValue = "I have set the FieldValue.";
         }
         else
         {
             fieldValue += " (I have appended the FieldValue.)";
         }
         optionObject.SetFieldValue("123", fieldValue);
     }
     return(optionObject.ToReturnOptionObject(ErrorCode.Success, "If FieldNumber 123 is found in OptionObject, then it should be the only FieldObject returned. Otherwise, no Forms should be returned."));
 }
        public void OptionObject_Clone_AreEqual()
        {
            List <FieldObject> fieldObjects = new List <FieldObject>
            {
                new FieldObject("123", "Test")
            };
            RowObject    rowObject    = new RowObject("1||1", fieldObjects);
            FormObject   formObject   = new FormObject("1", rowObject);
            OptionObject optionObject = new OptionObject("USER00", "userId", "000111", "1", "123456", 1, "UAT");

            optionObject.AddFormObject(formObject);

            OptionObject cloneOptionObject = optionObject.Clone();

            Assert.AreEqual(optionObject, cloneOptionObject);
            Assert.IsTrue(optionObject.IsFieldPresent("123"));
            Assert.IsTrue(cloneOptionObject.IsFieldPresent("123"));
        }
예제 #12
0
        public void OptionObject_ReturnOptionObject_AreNotEqual()
        {
            List <FieldObject> fieldObjects = new List <FieldObject>
            {
                new FieldObject("123", "Test")
            };
            RowObject    rowObject    = new RowObject("1||1", fieldObjects);
            FormObject   formObject   = new FormObject("1", rowObject);
            OptionObject optionObject = new OptionObject("USER00", "userId", "000111", "1", "123456", 1, "UAT");

            optionObject.AddFormObject(formObject);

            OptionObject returnOptionObject = optionObject.ToReturnOptionObject();

            Assert.AreNotEqual(optionObject, returnOptionObject);
            Assert.IsTrue(optionObject.IsFieldPresent("123"));
            Assert.IsFalse(returnOptionObject.IsFieldPresent("123"));
        }
예제 #13
0
        public void Clone_OptionObject_AreNotEqual()
        {
            List <FieldObject> fieldObjects = new List <FieldObject>
            {
                new FieldObject("123", "Test")
            };
            RowObject    rowObject    = new RowObject("1||1", fieldObjects);
            FormObject   formObject   = new FormObject("1", rowObject);
            OptionObject optionObject = new OptionObject("USER00", "userId", "000111", "1", "123456", 1, "UAT");

            optionObject.AddFormObject(formObject);

            OptionObject cloneOptionObject = (OptionObject)ScriptLinkHelpers.Clone(optionObject);

            optionObject.SetFieldValue("123", "Modified");

            Assert.AreNotEqual(optionObject, cloneOptionObject);
            Assert.IsTrue(optionObject.IsFieldPresent("123"));
            Assert.IsTrue(cloneOptionObject.IsFieldPresent("123"));
        }
        public void OptionObject_IsFieldPresent_IsTrue()
        {
            var actual = configuredOptionObject.IsFieldPresent("123");

            Assert.IsTrue(actual);
        }