public void OptionObject_AddFormObject_Properties_Exception()
        {
            OptionObject optionObject = new OptionObject();

            optionObject.AddFormObject("1", false);
            Assert.AreEqual(1, optionObject.Forms.Count);
            optionObject.AddFormObject("1", false);
            Assert.AreEqual(1, optionObject.Forms.Count);
        }
Exemple #2
0
        public void IsFormPresent_OptionObject_SecondForm_IsPresent()
        {
            string       formNumber   = "2";
            FormObject   formObject1  = new FormObject("1");
            FormObject   formObject2  = new FormObject(formNumber);
            OptionObject optionObject = new OptionObject();

            optionObject.AddFormObject(formObject1);
            optionObject.AddFormObject(formObject2);
            Assert.IsTrue(optionObject.IsFormPresent(formNumber));
        }
        public void IsRowMarkedForDeletion_OptionObject_SecondForm_IsNotMarked()
        {
            string     rowId       = "2||1";
            FormObject formObject1 = new FormObject("1");

            formObject1.AddRowObject(new RowObject());
            FormObject formObject2 = new FormObject("2");

            formObject2.AddRowObject(new RowObject(rowId));
            OptionObject optionObject = new OptionObject();

            optionObject.AddFormObject(formObject1);
            optionObject.AddFormObject(formObject2);
            Assert.IsFalse(optionObject.IsRowMarkedForDeletion(rowId));
        }
Exemple #4
0
        public void IsFieldLocked_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.IsTrue(optionObject.IsFieldLocked("234"));
        }
        public void IsFieldEnabled_OptionObject_SecondForm_IsNotEnabled()
        {
            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.IsFieldEnabled(fieldNumber));
        }
Exemple #6
0
        public void IsFormPresent_OptionObject_IsNotPresent()
        {
            string       formNumber   = "1";
            FormObject   formObject   = new FormObject(formNumber);
            OptionObject optionObject = new OptionObject();

            optionObject.AddFormObject(formObject);
            Assert.IsFalse(optionObject.IsFormPresent("2"));
        }
Exemple #7
0
        public void IsFormPresent_OptionObject_FirstForm_IsPresent()
        {
            string       formNumber   = "1";
            FormObject   formObject   = new FormObject(formNumber);
            OptionObject optionObject = new OptionObject();

            optionObject.AddFormObject(formObject);
            Assert.IsTrue(optionObject.IsFormPresent(formNumber));
        }
        public void OptionObject_AddFormObject_FormObject_Exception()
        {
            FormObject formObject1 = new FormObject
            {
                FormId            = "1",
                MultipleIteration = false
            };
            FormObject formObject2 = new FormObject
            {
                FormId            = "2",
                MultipleIteration = true
            };
            OptionObject optionObject = new OptionObject();

            optionObject.AddFormObject(formObject1);
            Assert.AreEqual(1, optionObject.Forms.Count);
            optionObject.AddFormObject(formObject1);
            Assert.AreEqual(1, optionObject.Forms.Count);
        }
        public void IsRowMarkedForDeletion_OptionObject_FirstForm_IsNotMarked()
        {
            string     rowId      = "1||1";
            FormObject formObject = new FormObject("1");

            formObject.AddRowObject(new RowObject(rowId));
            OptionObject optionObject = new OptionObject();

            optionObject.AddFormObject(formObject);
            Assert.IsFalse(optionObject.IsRowMarkedForDeletion(rowId));
        }
        public void IsRowMarkedForDeletion_OptionObject_IsNotPresent()
        {
            string     rowId      = "1||1";
            RowObject  rowObject  = new RowObject(rowId);
            FormObject formObject = new FormObject("1");

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

            optionObject.AddFormObject(formObject);
            Assert.IsFalse(optionObject.IsRowMarkedForDeletion("2||1"));
        }
Exemple #11
0
        public void IsFieldLocked_OptionObject_FirstForm_IsNotLocked()
        {
            string    fieldNumber = "123";
            RowObject rowObject   = new RowObject();

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

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

            optionObject.AddFormObject(formObject);
            Assert.IsFalse(optionObject.IsFieldLocked(fieldNumber));
        }
        public void GetCurrentRowId_FromOptionObject_NullFormId()
        {
            string     expected   = "1||1";
            RowObject  rowObject  = new RowObject();
            FormObject formObject = new FormObject();

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

            optionObject.AddFormObject(formObject);
            string actual = ScriptLinkHelpers.GetCurrentRowId(optionObject, "1");

            Assert.AreEqual(expected, actual);
        }
        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 void SetDisabledField_OptionObject_FieldNumber_IsNotPresent()
        {
            string      fieldNumber = "123";
            FieldObject fieldObject = new FieldObject(fieldNumber);
            RowObject   rowObject   = new RowObject();

            rowObject.AddFieldObject(fieldObject);
            FormObject formObject = new FormObject("1");

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

            optionObject.AddFormObject(formObject);
            optionObject.SetDisabledField(fieldNumber);
            Assert.IsFalse(optionObject.IsFieldEnabled("234"));
        }
Exemple #15
0
        public void SetUnlockedField_OptionObject_FieldNumber()
        {
            string      fieldNumber = "123";
            FieldObject fieldObject = new FieldObject(fieldNumber);
            RowObject   rowObject   = new RowObject();

            rowObject.AddFieldObject(fieldObject);
            FormObject formObject = new FormObject("1");

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

            optionObject.AddFormObject(formObject);
            optionObject.SetUnlockedField(fieldNumber);
            Assert.IsFalse(optionObject.IsFieldLocked(fieldNumber));
        }
Exemple #16
0
        public void SetUnlockedField_OptionObject_Helper_FieldNumber_IsNotPresent()
        {
            string      fieldNumber = "123";
            FieldObject fieldObject = new FieldObject(fieldNumber);
            RowObject   rowObject   = new RowObject();

            rowObject.AddFieldObject(fieldObject);
            FormObject formObject = new FormObject("1");

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

            optionObject.AddFormObject(formObject);
            ScriptLinkHelpers.SetUnlockedField(optionObject, fieldNumber);
            Assert.IsFalse(optionObject.IsFieldLocked("234"));
        }
        public void SetDisabledField_OptionObject_Helper_FieldNumber()
        {
            string      fieldNumber = "123";
            FieldObject fieldObject = new FieldObject(fieldNumber);
            RowObject   rowObject   = new RowObject();

            rowObject.AddFieldObject(fieldObject);
            FormObject formObject = new FormObject("1");

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

            optionObject.AddFormObject(formObject);
            OptionObjectHelpers.SetDisabledField(optionObject, fieldNumber);
            Assert.IsFalse(optionObject.IsFieldEnabled(fieldNumber));
        }
Exemple #18
0
        public void SetLockedFields_OptionObject_Helper_ListFieldNumbers_Null()
        {
            string        fieldNumber  = "123";
            FieldObject   fieldObject  = new FieldObject(fieldNumber);
            List <string> fieldNumbers = null;
            RowObject     rowObject    = new RowObject();

            rowObject.AddFieldObject(fieldObject);
            FormObject formObject = new FormObject("1");

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

            optionObject.AddFormObject(formObject);
            ScriptLinkHelpers.SetLockedFields(optionObject, fieldNumbers);
            Assert.IsFalse(optionObject.IsFieldLocked(fieldNumber));
        }
        public void SetDisabledFields_OptionObject_ListFieldNumbers_Null()
        {
            string        fieldNumber  = "123";
            FieldObject   fieldObject  = new FieldObject(fieldNumber);
            List <string> fieldNumbers = null;
            RowObject     rowObject    = new RowObject();

            rowObject.AddFieldObject(fieldObject);
            FormObject formObject = new FormObject("1");

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

            optionObject.AddFormObject(formObject);
            optionObject.SetDisabledFields(fieldNumbers);
            Assert.IsFalse(optionObject.IsFieldEnabled(fieldNumber));
        }
        public void SetOptionalField_OptionObject_FieldNumber()
        {
            string      fieldNumber = "123";
            FieldObject fieldObject = new FieldObject(fieldNumber);
            RowObject   rowObject   = new RowObject();

            rowObject.AddFieldObject(fieldObject);
            FormObject formObject = new FormObject("1");

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

            optionObject.AddFormObject(formObject);
            optionObject.SetOptionalField(fieldNumber);
            Assert.IsTrue(optionObject.IsFieldEnabled(fieldNumber));
            Assert.IsFalse(optionObject.IsFieldRequired(fieldNumber));
        }
        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"));
        }
        public void GetCurrentRowId_FromOptionObject_Success()
        {
            string     expected   = "1||1";
            RowObject  rowObject  = new RowObject();
            FormObject formObject = new FormObject()
            {
                FormId            = "1",
                MultipleIteration = false
            };

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

            optionObject.AddFormObject(formObject);
            string actual = ScriptLinkHelpers.GetCurrentRowId(optionObject, "1");

            Assert.AreEqual(expected, actual);
        }
Exemple #23
0
        public void SetEnabledFields_OptionObject_Helper_ListFieldObjects_Null()
        {
            string             fieldNumber  = "123";
            FieldObject        fieldObject  = new FieldObject(fieldNumber);
            List <FieldObject> fieldObjects = null;
            RowObject          rowObject    = new RowObject();

            rowObject.AddFieldObject(fieldObject);
            FormObject formObject = new FormObject("1");

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

            optionObject.AddFormObject(formObject);
            OptionObjectHelpers.SetEnabledFields(optionObject, fieldObjects);
            Assert.IsFalse(optionObject.IsFieldEnabled(fieldNumber));
            Assert.IsFalse(optionObject.IsFieldRequired(fieldNumber));
        }
Exemple #24
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"));
        }
        public void IsRowPresent_OptionObject_RowIdEmpty_Error()
        {
            // Arrange
            string rowId      = "";
            var    rowObject  = new RowObject();
            var    formObject = new FormObject()
            {
                CurrentRow = rowObject
            };
            var optionObject = new OptionObject();

            optionObject.AddFormObject(formObject);

            // Act
            bool actual = optionObject.IsRowPresent(rowId);

            // Assert
            Assert.IsTrue(actual);
        }
        public void IsRowPresent_OptionObjectHelpers_OptionObject_RowIdNull_Error()
        {
            // Arrange
            string rowId      = null;
            var    rowObject  = new RowObject();
            var    formObject = new FormObject()
            {
                CurrentRow = rowObject
            };
            var optionObject = new OptionObject();

            optionObject.AddFormObject(formObject);

            // Act
            bool actual = OptionObjectHelpers.IsRowPresent(optionObject, rowId);

            // Assert
            Assert.IsTrue(actual);
        }
Exemple #27
0
        public void SetFieldObjects_OptionObject_Disabled_FieldNumbersNull()
        {
            string        fieldNumber  = "123";
            List <string> fieldNumbers = null;
            RowObject     rowObject    = new RowObject();

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

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

            optionObject.AddFormObject(formObject);

            ScriptLinkHelpers.SetFieldObjects(optionObject, FieldAction.Disable, fieldNumbers);

            Assert.IsFalse(optionObject.IsFieldEnabled(fieldNumber));
            Assert.IsFalse(optionObject.IsFieldRequired(fieldNumber));
        }
Exemple #28
0
        public void SetLockedFields_OptionObject_ListFieldNumbers()
        {
            string        fieldNumber  = "123";
            FieldObject   fieldObject  = new FieldObject(fieldNumber);
            List <string> fieldNumbers = new List <string>()
            {
                fieldNumber
            };
            RowObject rowObject = new RowObject();

            rowObject.AddFieldObject(fieldObject);
            FormObject formObject = new FormObject("1");

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

            optionObject.AddFormObject(formObject);
            optionObject.SetLockedFields(fieldNumbers);
            Assert.IsTrue(optionObject.IsFieldLocked(fieldNumber));
        }
        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 SetDisabledFields_OptionObject_Helper_ListFieldObjects()
        {
            string             fieldNumber  = "123";
            FieldObject        fieldObject  = new FieldObject(fieldNumber);
            List <FieldObject> fieldObjects = new List <FieldObject>()
            {
                fieldObject
            };
            RowObject rowObject = new RowObject();

            rowObject.AddFieldObject(fieldObject);
            FormObject formObject = new FormObject("1");

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

            optionObject.AddFormObject(formObject);
            ScriptLinkHelpers.SetDisabledFields(optionObject, fieldObjects);
            Assert.IsFalse(optionObject.IsFieldEnabled(fieldNumber));
        }