public void Any_ProxyValues_MatchesAny()
        {
            var input = new object[] { "abc", "123", "456" };
            var p     = new AttributeValueList(new List <object>(input));

            Assert.True(p.Any());
        }
Esempio n. 2
0
        /// <summary>
        /// Checks whether the pattern approximately matches (~=) any member of the
        /// multi-valued source.
        /// Warning: locally, this does a lower-invariant .Match(). This may not line
        /// up with LDAP implementations. Take local, unit test results with a grain of salt.
        /// </summary>
        /// <param name="source">The multi-valued source to match against.</param>
        /// <param name="pattern">The pattern to match (ex: some*thing).</param>
        /// <returns>True, if it matches.</returns>
        public static bool Approx(this AttributeValueList source, string pattern)
        {
            if (source == null)
            {
                return(false);
            }

            if (pattern == "*")
            {
                return(true); // existence check operator
            }

            return(source.Any(e => Approx(e.ToString(), pattern)));
        }