public void TestStartsWithFilter() { StartsWithFilter v1 = new StartsWithFilter(ConnectorAttributeBuilder.Build("foo", "bar")); StartsWithFilter v2 = (StartsWithFilter)CloneObject(v1); Assert.AreEqual(v1.GetAttribute(), v2.GetAttribute()); }
protected override String CreateStartsWithExpression(StartsWithFilter 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 TestStartsWithFilter() { StartsWithFilter v1 = new StartsWithFilter(ConnectorAttributeBuilder.Build("foo", "bar")); StartsWithFilter v2 = (StartsWithFilter)CloneObject(v1); Assert.AreEqual(v1.GetAttribute(), v2.GetAttribute()); }