예제 #1
0
        public static TOwner Contain <TOwner>(this IDataVerificationProvider <IEnumerable <IDataProvider <string, TOwner> >, TOwner> should, TermMatch match, IEnumerable <string> expected)
        {
            expected.CheckNotNullOrEmpty(nameof(expected));

            return(should.Satisfy(
                       actual => actual != null && should.IsNegation
                    ? expected.Any(expectedValue => actual.Any(actualValue => match.IsMatch(actualValue, expectedValue)))
                    : expected.All(expectedValue => actual.Any(actualValue => match.IsMatch(actualValue, expectedValue))),
                       $"contain having value that {match.ToString(TermCase.MidSentence)} {Stringifier.ToString(expected)}"));
        }
예제 #2
0
        public static TOwner ContainSoft <TOwner>(this IDataVerificationProvider <IEnumerable <IDataProvider <string, TOwner> >, TOwner> should, TermMatch match, params string[] expected)
            where TOwner : PageObject <TOwner>
        {
            expected.CheckNotNullOrEmpty(nameof(expected));

            return(should.SatisfySoft(
                       actual => actual != null && should.IsNegation
                    ? expected.Any(expectedValue => actual.Any(actualValue => match.IsMatch(actualValue, expectedValue)))
                    : expected.All(expectedValue => actual.Any(actualValue => match.IsMatch(actualValue, expectedValue))),
                       $"contain having value that {match.ToString(TermCase.MidSentence)} {CollectionToString(expected)}"));
        }
        public static TOwner Contain <TOwner>(this IDataVerificationProvider <IEnumerable <IDataProvider <string, TOwner> >, TOwner> should, TermMatch match, params string[] expected)
            where TOwner : PageObject <TOwner>
        {
            expected.CheckNotNullOrEmpty(nameof(expected));

            return(should.Satisfy(
                       actual =>
            {
                if (actual == null)
                {
                    return false;
                }

                var actualValues = actual.Select(x => x.Value).ToArray();
                return expected.All(expectedValue => actualValues.Any(actualValue => match.IsMatch(actualValue, expectedValue)));
            },
                       $"contain having value that {match.ToString(TermCase.Lower)} {CollectionToString(expected)}"));
        }
        public static TOwner ContainHavingContent <TControl, TOwner>(this IDataVerificationProvider <IEnumerable <TControl>, TOwner> should, TermMatch match, params string[] expected)
            where TControl : Control <TOwner>
            where TOwner : PageObject <TOwner>
        {
            expected.CheckNotNullOrEmpty(nameof(expected));

            return(should.Satisfy(
                       actual =>
            {
                if (actual == null)
                {
                    return false;
                }

                var actualValues = actual.Select(x => x.Content.Value).ToArray();
                return expected.All(expectedValue => actualValues.Any(actualValue => match.IsMatch(actualValue, expectedValue)));
            },
                       $"contain {UIComponentResolver.ResolveControlTypeName<TControl>()} having content that {match.ToString(TermCase.Lower)} {CollectionToString(expected)}"));
        }
        public static TOwner ContainHavingContent <TControl, TOwner>(this IDataVerificationProvider <IEnumerable <TControl>, TOwner> should, TermMatch match, params string[] expected)
            where TControl : Control <TOwner>
            where TOwner : PageObject <TOwner>
        {
            expected.CheckNotNullOrEmpty(nameof(expected));

            return(should.Satisfy(
                       actual =>
            {
                if (actual == null)
                {
                    return false;
                }

                var actualValues = actual.Select(x => x.Content.Value).ToArray();
                return should.IsNegation
                        ? expected.Any(expectedValue => actualValues.Any(actualValue => match.IsMatch(actualValue, expectedValue)))
                        : expected.All(expectedValue => actualValues.Any(actualValue => match.IsMatch(actualValue, expectedValue)));
            },
                       $"contain having content that {match.ToString(TermCase.MidSentence)} {VerificationUtils.ToString(expected)}"));
        }