예제 #1
0
 public void TestCreation()
 {
     CustomField cf = new CustomField(_Id, _Value);
     Assert.IsNotNull(cf);
     Assert.AreEqual(_Id,cf.Id);
     Assert.AreEqual(_Value, cf.Value);
 }
예제 #2
0
 public void TestCreation1()
 {
     CustomField cf = new CustomField(_ProjectId,_Name,_DataType,_Required,_FieldType);
     Assert.IsNotNull(cf);
     Assert.AreEqual(_ProjectId, cf.ProjectId);
     Assert.AreEqual(_Name, cf.Name);
     Assert.AreEqual(_DataType, cf.DataType);
     Assert.AreEqual(_Required, cf.Required);
     Assert.AreEqual(_FieldType, cf.FieldType);
 }
        /// <summary>
        /// Handles the Click event of the lnkAddCustomField control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
        protected void lnkAddCustomField_Click(object sender, EventArgs e)
        {
            string NewName = txtName.Text.Trim();

            if (NewName == String.Empty)
                return;

            ValidationDataType DataType = (ValidationDataType)Enum.Parse(typeof(ValidationDataType), dropDataType.SelectedValue);
            CustomField.CustomFieldType FieldType = (CustomField.CustomFieldType)Enum.Parse(typeof(CustomField.CustomFieldType), rblCustomFieldType.SelectedValue);
            bool required = chkRequired.Checked;

            CustomField newCustomField = new CustomField(ProjectId, NewName, DataType, required, FieldType);
            if (newCustomField.Save())
            {
                txtName.Text = "";
                dropDataType.SelectedIndex = 0;
                chkRequired.Checked = false;
                BindCustomFields();
            }
            else
            {
                lblError.Text = Logging.GetErrorMessageResource("SaveCustomFieldError");
            }
        }
예제 #4
0
 public void TestNameProperty()
 {
     CustomField cf = new CustomField(_Id, _ProjectId, _Name, _DataType, _Required, _Value, _FieldType);
     Assert.AreEqual(_Name, cf.Name);
     cf.Name = "Testing123";
     Assert.AreEqual("Testing123", cf.Name);
 }
예제 #5
0
 public void TestValueProperty()
 {
     CustomField cf = new CustomField(_Id, _ProjectId, _Name, _DataType, _Required, _Value, _FieldType);
     Assert.AreEqual(_Value, cf.Value);
     cf.Value = "This is a new value";
     Assert.AreEqual("This is a new value", cf.Value);
 }