public void PolicyNameEqualsRuleSetInfo() { var rsi = new Microsoft.RuleEngine.RuleSetInfo("name", 1, 0); var pn1 = new PolicyName("name", 1, 0); var pn2 = new PolicyName("name", 1, 0); // PolicyName == PolicyName Assert.That(pn1 == pn2); Assert.That(pn2 == pn1); Assert.That(pn1.Equals(pn2)); // PolicyName == RuleSetInfo Assert.That(pn1 == rsi); Assert.That(pn1.Equals(rsi)); // RuleSetInfo == PolicyName Assert.That(rsi == pn1); Assert.That(rsi.Equals(pn1), Is.False); }
/// <summary> /// Converts the given object to the type of this converter, using the specified context and culture information. /// </summary> /// <returns> /// An <see cref="T:System.Object"/> that represents the converted value. /// </returns> /// <param name="context"> /// An <see cref="T:System.ComponentModel.ITypeDescriptorContext"/> that provides a format context. /// </param> /// <param name="culture"> /// The <see cref="T:System.Globalization.CultureInfo"/> to use as the current culture. /// </param> /// <param name="value"> /// The <see cref="T:System.Object"/> to convert. /// </param> /// <exception cref="T:System.NotSupportedException"> /// The conversion cannot be performed. /// </exception> public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { var displayName = value as string; return(displayName != null?PolicyName.Parse(displayName) : base.ConvertFrom(context, culture, value)); }