示例#1
0
        public static TOwner MatchAny <TOwner>(this IDataVerificationProvider <string, TOwner> should, TermMatch match, params string[] expected)
        {
            expected.CheckNotNullOrEmpty(nameof(expected));

            var predicate = match.GetPredicate();

            string message = new StringBuilder().
                             Append($"{match.GetShouldText()} ").
                             AppendIf(expected.Length > 1, "any of: ").
                             AppendJoined(", ", Enumerable.Range(0, expected.Length).Select(x => $"{{{x}}}")).
                             ToString();

            return(should.Satisfy(actual => actual != null && expected.Any(x => predicate(actual, x)), message, expected));
        }
        public static bool IsMatch(this TermMatch match, string text, params string[] terms)
        {
            var predicate = match.GetPredicate();

            return(terms.Any(term => predicate(text, term)));
        }