public void TestGetDisplayName()
        {
            //nominal case - display name already set
            IDataElement dataElement = new DataElement(Guid.NewGuid(), new NonTranslateableLanguageItem("name"), new NonTranslateableLanguageItem("This is a preset Display Name"), DataType.String, DataItem.CreateDataItem(new NonTranslateableLanguageItem(""), DataType.String, "DOC_TYPE"));
            ConditionDisplayParameterCustomPropertyName customPropertyNameParam = new ConditionDisplayParameterCustomPropertyName(dataElement, this.Callback, Workshare.Policy.PolicyType.ClientEmail);
            Assert.AreEqual("DOC_TYPE", customPropertyNameParam.GetDisplayName(), "unexpected Text - display name should be same as dataElement");

            //data items in data item
            dataElement.DisplayName.Value = "";
            Assert.AreEqual(0, dataElement.DisplayName.Value.Length, "unexpected dataelement.displayname.value");
            Assert.AreEqual("DOC_TYPE", customPropertyNameParam.GetDisplayName(), "unexpected displayname");
            Assert.AreEqual("DOC_TYPE", dataElement.DisplayName.Value, "unexpected dataelement.displayname.value");

            //no data
            dataElement = new DataElement(Guid.NewGuid(), new NonTranslateableLanguageItem("name"), new NonTranslateableLanguageItem(""), DataType.String, DataItem.CreateDataItem(new NonTranslateableLanguageItem(""), DataType.String, ""));
            Assert.AreEqual(0, dataElement.DisplayName.Value.Length, "unexpected length on dataelement.displayname.value");
            customPropertyNameParam = new ConditionDisplayParameterCustomPropertyName(dataElement, this.Callback, Workshare.Policy.PolicyType.ClientEmail);
            Assert.AreEqual(Properties.Resources.IDS_EXPRESSION_PARAM_CUSTOMPROPERTYNAME_DEFAULT, customPropertyNameParam.GetDisplayName(), "unexpected displayname");
            Assert.AreEqual(Properties.Resources.IDS_EXPRESSION_PARAM_CUSTOMPROPERTYNAME_DEFAULT, dataElement.DisplayName.Value, "unexpected length on dataelement.displayname.value");

            //invalid format for data
            dataElement = new DataElement(Guid.NewGuid(), new NonTranslateableLanguageItem("name"), new NonTranslateableLanguageItem(""), DataType.String, new PolicyObjectCollection<IDataItem>());
            customPropertyNameParam = new ConditionDisplayParameterCustomPropertyName(null, this.Callback, Workshare.Policy.PolicyType.ClientEmail);
            customPropertyNameParam.Object = dataElement;
            try
            {
                string displayName = customPropertyNameParam.GetDisplayName();
                Assert.IsTrue(false, "didn't throw on invalid data format");
            }
            catch (PolicyDesignerException)
            {
                Assert.IsTrue(true);
            }
            catch
            {
                Assert.IsTrue(false, "Unexpected exception");
            }

            //no data
            customPropertyNameParam = new ConditionDisplayParameterCustomPropertyName(null, this.Callback, Workshare.Policy.PolicyType.ClientEmail);
            try
            {
                string displayName = customPropertyNameParam.GetDisplayName();
                Assert.IsTrue(false, "didn't throw on empty data");
            }
            catch (PolicyDesignerException)
            {
                Assert.IsTrue(true);
            }
            catch
            {
                Assert.IsTrue(false, "Unexpected exception");
            }
        }
        public void TestConstructor()
        {
            //empty dataElement
            ConditionDisplayParameterCustomPropertyName customPropertyNameParam = new ConditionDisplayParameterCustomPropertyName(null, this.Callback, Workshare.Policy.PolicyType.ClientEmail);
            Assert.IsTrue(Object.ReferenceEquals(null, customPropertyNameParam.Object), "unexpected Object");
            Assert.AreEqual(Properties.Resources.IDS_EXPRESSION_PARAM_CUSTOMPROPERTYNAME_DEFAULT, customPropertyNameParam.Text, "unexpected Text");

            //nominal case with no display name
            IDataElement dataElement = new DataElement(Guid.NewGuid(), new NonTranslateableLanguageItem("name"), new NonTranslateableLanguageItem(""), DataType.String, DataItem.CreateDataItem(new NonTranslateableLanguageItem(""), DataType.String, "DOC_TYPE"));
            customPropertyNameParam = new ConditionDisplayParameterCustomPropertyName(dataElement, this.Callback, Workshare.Policy.PolicyType.ClientEmail);
            Assert.IsTrue(Object.ReferenceEquals(dataElement, customPropertyNameParam.Object), "unexpected Object");
            Assert.AreEqual("DOC_TYPE", customPropertyNameParam.Text, "unexpected Text");

            m_callbackCalled = false;
            customPropertyNameParam.Execute();
            Assert.IsTrue(m_callbackCalled, "Execute not called");

            //nominal case with display name
            dataElement.DisplayName.Value = "This is a display name";
            customPropertyNameParam = new ConditionDisplayParameterCustomPropertyName(dataElement, this.Callback, Workshare.Policy.PolicyType.ClientEmail);
            Assert.IsTrue(Object.ReferenceEquals(dataElement, customPropertyNameParam.Object), "unexpected Object");
            Assert.AreEqual("DOC_TYPE", customPropertyNameParam.Text, "unexpected Text - display name should be same as dataElement");

            m_callbackCalled = false;
            customPropertyNameParam.Execute();
            Assert.IsTrue(m_callbackCalled, "Execute not called");

            //invalid format case
            try
            {
                dataElement = new DataElement(Guid.NewGuid(), new NonTranslateableLanguageItem("name"), new NonTranslateableLanguageItem(""), DataType.StringArray, new PolicyObjectCollection<IDataItem>());
                customPropertyNameParam = new ConditionDisplayParameterCustomPropertyName(dataElement, this.Callback, Workshare.Policy.PolicyType.ClientEmail);
                Assert.IsTrue(false, "Didnt throw on invalid dataelement");
            }
            catch (PolicyDesignerException)
            {
                Assert.IsTrue(true);
            }
            catch
            {
                Assert.IsTrue(false, "unexpected exception thrown");
            }
        }
        /// <summary>
        /// Creates hyperlink representation of the editable parameters within the condition
        /// </summary>
        /// <returns>An array of RuleObject objects representing the editable parameters</returns>
        private RuleObject[] GetHyperlinks()
        {
            try
            {
                IDataElement customPropertyNameDataElement = null;
                IDataElement customPropertyValueDataElement = null;
                CustomPropertyType customPropertyType = CustomPropertyType.Undefined;

                if (m_condition != null)
                {
                    IDataSource dataSource = (IDataSource)m_condition.DataLeft.Data;
                    IDataElement customPropertyTypeDataElement = dataSource.Method.Parameters[1].Value as IDataElement;
                    customPropertyType = (CustomPropertyType)Enum.Parse(typeof(CustomPropertyType), ((IDataItem)customPropertyTypeDataElement.Data).Value.ToString());
                    customPropertyNameDataElement = dataSource.Method.Parameters[2].Value as IDataElement;
                    customPropertyValueDataElement = dataSource.Method.Parameters[3].Value as IDataElement;
                }

                m_customPropertyNameData = new ConditionDisplayParameterCustomPropertyName(customPropertyNameDataElement, this.EditCustomPropertyNameParameter, m_type);
                m_customPropertyValueData = new ConditionDisplayParameterCustomPropertyValue(customPropertyType, customPropertyValueDataElement, this.EditCustomPropertyValueParameter, m_type);
                RuleObject[] hyperlinks = { m_customPropertyNameData, m_customPropertyValueData };

                return hyperlinks;
            }
            catch (Exception ex)
            {
				ArgumentException argumentException = new ArgumentException( "Not a valid CustomProperty condition.", ex);
				Logger.LogError(argumentException.Message);
				Logger.LogError(ex);
                throw argumentException;
            }
        }