public void GetFieldValueHelperOptionObjectMissingFieldReturnsError()
        {
            FieldObject fieldObject1 = new FieldObject("123", "TEST");
            RowObject   rowObject1   = new RowObject("1||1");
            FieldObject fieldObject2 = new FieldObject("123", "TESTED");
            RowObject   rowObject2   = new RowObject("1||2");

            rowObject1.Fields.Add(fieldObject1);
            rowObject2.Fields.Add(fieldObject2);
            FormObject formObject = new FormObject("1", rowObject1);

            formObject.OtherRows.Add(rowObject2);
            OptionObject optionObject = new OptionObject();

            optionObject.Forms.Add(formObject);
            string expected1 = "TEST";
            string expected2 = "TESTED";

            Assert.AreEqual(expected1, ScriptLinkHelpers.GetFieldValue(optionObject, "124"));
            Assert.AreNotEqual(expected2, ScriptLinkHelpers.GetFieldValue(optionObject, "124"));
            Assert.AreEqual(expected1, ScriptLinkHelpers.GetFieldValue(optionObject, "1", "1||1", "124"));
            Assert.AreEqual(expected2, ScriptLinkHelpers.GetFieldValue(optionObject, "1", "1||2", "124"));
        }
        public void AddFieldObject_ToRowObject_DuplicateFieldNumber()
        {
            FieldObject fieldObject1 = new FieldObject()
            {
                FieldNumber = "1",
                FieldValue  = "Test",
                Enabled     = "1",
                Required    = "0",
                Lock        = "0"
            };
            FieldObject fieldObject2 = new FieldObject()
            {
                FieldNumber = "1",
                FieldValue  = "Test 2",
                Enabled     = "1",
                Required    = "0",
                Lock        = "0"
            };
            RowObject rowObject = new RowObject();

            rowObject = (RowObject)ScriptLinkHelpers.AddFieldObject(rowObject, fieldObject1);
            rowObject = (RowObject)ScriptLinkHelpers.AddFieldObject(rowObject, fieldObject2);
            Assert.IsFalse(rowObject.IsFieldPresent("1"));
        }
示例#3
0
        public void SetFieldValue_FormObject_CurrentRow_NotMI_AreEqual()
        {
            string expected = "Test";

            var fieldObject = new FieldObject
            {
                FieldNumber = "123"
            };
            var rowObject = new RowObject
            {
                RowId = "1||1"
            };

            rowObject.Fields.Add(fieldObject);
            var formObject = new FormObject
            {
                CurrentRow = rowObject
            };

            formObject = (FormObject)ScriptLinkHelpers.SetFieldValue(formObject, "123", "Test");
            string actual = ScriptLinkHelpers.GetFieldValue(formObject, "123");

            Assert.AreEqual(expected, actual);
        }
示例#4
0
        public void GetReturnOptionObject_SystemCode_AreEqual()
        {
            IOptionObject returnOptionObject = ScriptLinkHelpers.GetReturnOptionObject(optionObject);

            Assert.AreEqual(optionObject.SystemCode, returnOptionObject.SystemCode);
        }
示例#5
0
        public void GetReturnOptionObject_Facility_AreEqual()
        {
            IOptionObject returnOptionObject = ScriptLinkHelpers.GetReturnOptionObject(optionObject);

            Assert.AreEqual(optionObject.Facility, returnOptionObject.Facility);
        }
示例#6
0
        public void GetReturnOptionObject_EntityID_AreEqual()
        {
            IOptionObject returnOptionObject = ScriptLinkHelpers.GetReturnOptionObject(optionObject);

            Assert.AreEqual(optionObject.EntityID, returnOptionObject.EntityID);
        }
 /// <summary>
 /// Returns a <see cref="string"/> with all of the contents of the <see cref="OptionObject2015"/> formatted as XML.
 /// </summary>
 /// <returns><see cref="string"/> of all of the contents of the <see cref="OptionObject2015"/> formatted as XML.</returns>
 public string ToXml() => ScriptLinkHelpers.TransformToXml(this);
 /// <summary>
 /// Creates an <see cref="OptionObject2015"/> with the minimal information required to return.
 /// </summary>
 /// <returns></returns>
 public OptionObject2015 ToReturnOptionObject() => (OptionObject2015)ScriptLinkHelpers.GetReturnOptionObject(this);
 /// <summary>
 /// Transforms the <see cref="OptionObject2015"/>  to an <see cref="OptionObject"/>.
 /// </summary>
 /// <returns></returns>
 public OptionObject ToOptionObject() => (OptionObject)ScriptLinkHelpers.TransformToOptionObject(this);
 /// <summary>
 /// Returns whether the specified <see cref="RowObject"/> is marked for deletion.
 /// </summary>
 /// <param name="rowId"></param>
 /// <returns></returns>
 public bool IsRowMarkedForDeletion(string rowId) => ScriptLinkHelpers.IsRowMarkedForDeletion(this, rowId);
 /// <summary>
 /// Returns whether the specified <see cref="FormObject"/> is present.
 /// </summary>
 /// <param name="formId"></param>
 /// <returns></returns>
 public bool IsFormPresent(string formId) => ScriptLinkHelpers.IsFormPresent(this, formId);
 /// <summary>
 /// Returns whether the specified field is required.
 /// </summary>
 /// <param name="fieldNumber"></param>
 /// <returns></returns>
 public bool IsFieldRequired(string fieldNumber) => ScriptLinkHelpers.IsFieldRequired(this, fieldNumber);
 /// <summary>
 /// Returns whether the specified field is present.
 /// </summary>
 /// <param name="fieldNumber"></param>
 /// <returns></returns>
 public bool IsFieldPresent(string fieldNumber) => ScriptLinkHelpers.IsFieldPresent(this, fieldNumber);
 /// <summary>
 /// Returns the CurrentRow ParentRowId of the form matching the FormId.
 /// </summary>
 /// <param name="formId"></param>
 /// <returns></returns>
 public string GetParentRowId(string formId) => ScriptLinkHelpers.GetParentRowId(this, formId);
 /// <summary>
 /// Returns the Multiple Iteration Status of the form matching the FormId.
 /// </summary>
 /// <param name="formId"></param>
 /// <returns></returns>
 public bool GetMultipleIterationStatus(string formId) => ScriptLinkHelpers.GetMultipleIterationStatus(this, formId);
 /// <summary>
 /// Returns a <see cref="string"/> with all of the contents of the <see cref="OptionObject2015"/> formatted in HTML.
 /// </summary>
 /// <param name="includeHtmlHeaders">Determines whether to include the HTML headers in return. False allows for the embedding of the HTML in another HTML document.</param>
 /// <returns><see cref="string"/> of all of the contents of the <see cref="OptionObject2015"/> formatted in HTML.</returns>
 public string ToHtmlString(bool includeHtmlHeaders) => ScriptLinkHelpers.TransformToHtmlString(this, includeHtmlHeaders);
 /// <summary>
 /// Returns a <see cref="string"/> with all of the contents of the <see cref="OptionObject2015"/> formatted as JSON.
 /// </summary>
 /// <returns><see cref="string"/> of all of the contents of the <see cref="OptionObject2015"/> formatted as JSON.</returns>
 public string ToJson() => ScriptLinkHelpers.TransformToJson(this);
 /// <summary>
 /// Returns whether the specified <see cref="RowObject"/> is present.
 /// </summary>
 /// <param name="rowId"></param>
 /// <returns></returns>
 public bool IsRowPresent(string rowId) => ScriptLinkHelpers.IsRowPresent(this, rowId);
 /// <summary>
 /// Transforms the <see cref="OptionObject2015"/>  to an <see cref="OptionObject2"/>.
 /// </summary>
 /// <returns></returns>
 public OptionObject2 ToOptionObject2() => (OptionObject2)ScriptLinkHelpers.TransformToOptionObject2(this);
 /// <summary>
 /// Sets the FieldValue of a <see cref="FieldObject"/> in the <see cref="OptionObject2015"/>
 /// </summary>
 /// <param name="formId"></param>
 /// <param name="rowId"></param>
 /// <param name="fieldNumber"></param>
 /// <param name="fieldValue"></param>
 public void SetFieldValue(string formId, string rowId, string fieldNumber, string fieldValue) => this.Forms = ScriptLinkHelpers.SetFieldValue(this, formId, rowId, fieldNumber, fieldValue).Forms;
 /// <summary>
 /// Creates an <see cref="OptionObject2015"/> with the minimal information required to return plus the provide Error Code and Message.
 /// </summary>
 /// <param name="errorCode"></param>
 /// <param name="errorMessage"></param>
 /// <returns></returns>
 public OptionObject2015 ToReturnOptionObject(int errorCode, string errorMessage) => (OptionObject2015)ScriptLinkHelpers.GetReturnOptionObject(this, errorCode, errorMessage);
 /// <summary>
 /// Set the specified field as not required and enables if disabled.
 /// </summary>
 /// <param name="fieldNumber"></param>
 public void SetOptionalField(string fieldNumber) => this.Forms = ScriptLinkHelpers.SetOptionalField(this, fieldNumber).Forms;
示例#23
0
        public void GetReturnOptionObject_ErrorCode_Default_AreEqual()
        {
            IOptionObject returnOptionObject = ScriptLinkHelpers.GetReturnOptionObject(optionObject);

            Assert.AreEqual(0, returnOptionObject.ErrorCode);
        }
 /// <summary>
 /// Set the specified fields as not required and enables if disabled.
 /// </summary>
 /// <param name="fieldNumbers"></param>
 public void SetOptionalFields(List <string> fieldNumbers) => this.Forms = ScriptLinkHelpers.SetOptionalFields(this, fieldNumbers).Forms;
示例#25
0
        public void GetReturnOptionObject_EpisodeNumber_AreEqual()
        {
            IOptionObject returnOptionObject = ScriptLinkHelpers.GetReturnOptionObject(optionObject);

            Assert.AreEqual(optionObject.EpisodeNumber, returnOptionObject.EpisodeNumber);
        }
 /// <summary>
 /// Set the specified field as unlocked.
 /// </summary>
 /// <param name="fieldNumber"></param>
 public void SetUnlockedField(string fieldNumber) => this.Forms = ScriptLinkHelpers.SetUnlockedField(this, fieldNumber).Forms;
示例#27
0
        public void GetReturnOptionObject_OptionUserId_AreEqual()
        {
            IOptionObject returnOptionObject = ScriptLinkHelpers.GetReturnOptionObject(optionObject);

            Assert.AreEqual(optionObject.OptionUserId, returnOptionObject.OptionUserId);
        }
 /// <summary>
 /// Set the specified fields as unlocked.
 /// </summary>
 /// <param name="fieldNumbers"></param>
 public void SetUnlockedFields(List <string> fieldNumbers) => this.Forms = ScriptLinkHelpers.SetUnlockedFields(this, fieldNumbers).Forms;
 /// <summary>
 /// Transforms an object to a Xml-formatted string.
 /// </summary>
 /// <typeparam name="T">Type of object.</typeparam>
 /// <param name="objectToTransform">object to transform.</param>
 /// <returns></returns>
 public static string TransformToXml <T>(T objectToTransform) => ScriptLinkHelpers.SerializeObjectToXmlString(objectToTransform);
 /// <summary>
 /// Returns a <see cref="string"/> with all of the contents of the <see cref="OptionObject2015"/> formatted in HTML.
 /// </summary>
 /// <returns><see cref="string"/> of all of the contents of the <see cref="OptionObject2015"/> formatted in HTML.</returns>
 public string ToHtmlString() => ScriptLinkHelpers.TransformToHtmlString(this);