public void TestConstructor() { //empty dataElement ConditionDisplayParameterCustomPropertyValue customPropertyValueParam = new ConditionDisplayParameterCustomPropertyValue(CustomPropertyType.Text, null, this.Callback, Workshare.Policy.PolicyType.ClientEmail); Assert.IsTrue(Object.ReferenceEquals(null, customPropertyValueParam.Object), "unexpected Object"); Assert.AreEqual(Properties.Resources.IDS_EXPRESSION_PARAM_CUSTOMPROPERTYVALUE_DEFAULT, customPropertyValueParam.Text, "unexpected Text"); Assert.AreEqual(Enum.GetName(typeof(CustomPropertyType), CustomPropertyType.Text), customPropertyValueParam.Type.ToString(), "unexpected custom property type"); //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, "My Doc Type")); customPropertyValueParam = new ConditionDisplayParameterCustomPropertyValue(CustomPropertyType.Text, dataElement, this.Callback, Workshare.Policy.PolicyType.ClientEmail); Assert.IsTrue(Object.ReferenceEquals(dataElement, customPropertyValueParam.Object), "unexpected Object"); Assert.AreEqual("My Doc Type", customPropertyValueParam.Text, "unexpected Text"); Assert.AreEqual(Enum.GetName(typeof(CustomPropertyType), CustomPropertyType.Text), customPropertyValueParam.Type.ToString(), "unexpected custom property type"); m_callbackCalled = false; customPropertyValueParam.Execute(); Assert.IsTrue(m_callbackCalled, "Execute not called"); //nominal case with display name dataElement.DisplayName.Value = "This is a display name"; customPropertyValueParam = new ConditionDisplayParameterCustomPropertyValue(CustomPropertyType.Text, dataElement, this.Callback, Workshare.Policy.PolicyType.ClientEmail); Assert.IsTrue(Object.ReferenceEquals(dataElement, customPropertyValueParam.Object), "unexpected Object"); Assert.AreEqual("My Doc Type", customPropertyValueParam.Text, "unexpected Text - display name should be the same as dataElement"); Assert.AreEqual(Enum.GetName(typeof(CustomPropertyType), CustomPropertyType.Text), customPropertyValueParam.Type.ToString(), "unexpected custom property type"); m_callbackCalled = false; customPropertyValueParam.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>()); customPropertyValueParam = new ConditionDisplayParameterCustomPropertyValue(CustomPropertyType.Text, 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"); } }