public void TestEndsWithFilter() { EndsWithFilter v1 = new EndsWithFilter(ConnectorAttributeBuilder.Build("foo", "bar")); EndsWithFilter v2 = (EndsWithFilter)CloneObject(v1); Assert.AreEqual(v1.GetAttribute(), v2.GetAttribute()); }
protected override String CreateEndsWithExpression(EndsWithFilter filter, Boolean not) { String[] attrNames = GetLdapNamesForAttribute(filter.GetAttribute()); if (attrNames == null) { return(null); } StringBuilder builder = new StringBuilder(); if (not) { builder.Append("(!"); } if (attrNames.Length == 1) { builder.Append('('); builder.Append(attrNames[0]); builder.Append("=*"); GetLdapFilterValue(builder, attrNames[0], filter.GetValue()); builder.Append(')'); } else { builder.Append("(|"); foreach (String attrName in attrNames) { builder.Append('('); builder.Append(attrName); builder.Append("=*"); GetLdapFilterValue(builder, attrName, filter.GetValue()); builder.Append(')'); } builder.Append(')'); } if (not) { builder.Append(')'); } return(builder.ToString()); }
public void TestEndsWithFilter() { EndsWithFilter v1 = new EndsWithFilter(ConnectorAttributeBuilder.Build("foo", "bar")); EndsWithFilter v2 = (EndsWithFilter)CloneObject(v1); Assert.AreEqual(v1.GetAttribute(), v2.GetAttribute()); }