private void EnsureMandatoryValuesAreProvided(GlobalCustomFieldData customField) { var customFieldDataErrors = new StringBuilder(); if (customField == null) { customFieldDataErrors.Append("\n- No custom field data present in the test data"); } else { if (string.IsNullOrWhiteSpace(customField.ApplyTo.ToString())) { customFieldDataErrors.Append("\n- Custom Field ApplyTo not set"); } if (string.IsNullOrWhiteSpace(customField.Type.ToString())) { customFieldDataErrors.Append("\n- Custom Field Type not set"); } if (string.IsNullOrWhiteSpace(customField.Name)) { customFieldDataErrors.Append("\n- Custom Field Name not set"); } } if (!string.IsNullOrEmpty(customFieldDataErrors.ToString())) { throw new ArgumentException($"The feature file {FeatureContext.FeatureInfo.Title} has the following data issues:\n {customFieldDataErrors}"); } }
public void CreateCustomField(GlobalCustomFieldData globalCustomField) { EnsureMandatoryValuesAreProvided(globalCustomField); SelectSingleValueFromReactDropdownByText(_ddlApplyTo, globalCustomField.ApplyTo.ToString()); SelectSingleValueFromReactDropdownByText(_ddlType, GetCustomFieldTypeDisplayName(globalCustomField.Type)); ClearInputAndTypeValue(_txtName, globalCustomField.Name); ClickElement(_btnSave); }