示例#1
0
 public static TOwner BeTrue <TOwner>(this IDataVerificationProvider <bool?, TOwner> should)
 {
     return(should.Satisfy(actual => actual == true, "be true"));
 }
 public static TOwner BeTrue <TOwner>(this IDataVerificationProvider <bool, TOwner> should)
     where TOwner : PageObject <TOwner>
 {
     return(should.Satisfy(actual => actual, "be true"));
 }
 public static TOwner BeNull <TData, TOwner>(this IDataVerificationProvider <TData, TOwner> should)
     where TOwner : PageObject <TOwner>
 {
     return(should.Satisfy(actual => Equals(actual, null), "be null"));
 }
示例#4
0
 public static TOwner BeGreaterOrEqualDateTime <TOwner>(this IDataVerificationProvider <DateTime, TOwner> should, DateTime expected)
     where TOwner : PageObject <TOwner>
 {
     return(should.Satisfy(actual => DateTime.Compare(actual, expected) >= 0, "be greater or equal than date {0}", expected));
 }
示例#5
0
 public static TOwner BeLessOrEqualDateTime <TOwner>(this IDataVerificationProvider <DateTime?, TOwner> should, DateTime expected)
     where TOwner : PageObject <TOwner>
 {
     return(should.Satisfy(actual => actual != null && DateTime.Compare(actual.Value, expected) <= 0, "be less or equal than date {0}", expected));
 }
示例#6
0
 public static TOwner BeInRange <TData, TOwner>(this IDataVerificationProvider <TData?, TOwner> should, TData from, TData to)
     where TData : struct, IComparable <TData>, IComparable
     where TOwner : PageObject <TOwner>
 {
     return(should.Satisfy(actual => actual != null && actual.Value.CompareTo(from) >= 0 && actual.Value.CompareTo(to) <= 0, "be in range {0} - {1}", from, to));
 }
示例#7
0
 public static TOwner BeEmpty <TData, TOwner>(this IDataVerificationProvider <IEnumerable <TData>, TOwner> should)
     where TOwner : PageObject <TOwner>
 {
     return(should.Satisfy(actual => actual != null && !actual.Any(), "be empty"));
 }
示例#8
0
 public static TOwner BeGreater <TData, TOwner>(this IDataVerificationProvider <TData?, TOwner> should, TData expected)
     where TData : struct, IComparable <TData>, IComparable
 {
     return(should.Satisfy(actual => actual != null && actual.Value.CompareTo(expected) > 0, "be greater than {0}", expected));
 }
示例#9
0
 public static TOwner EqualDate <TOwner>(this IDataVerificationProvider <DateTime, TOwner> should, DateTime expected)
 {
     return(should.Satisfy(actual => Equals(actual.Date, expected.Date), "equal date {0}", expected));
 }
示例#10
0
        public static TOwner EndWithIgnoringCase <TOwner>(this IDataVerificationProvider <string, TOwner> should, string expected)
        {
            expected.CheckNotNull(nameof(expected));

            return(should.Satisfy(actual => actual != null && actual.EndsWith(expected, StringComparison.CurrentCultureIgnoreCase), "end with {0} ignoring case", expected));
        }
示例#11
0
        public static TOwner Match <TOwner>(this IDataVerificationProvider <string, TOwner> should, string pattern)
        {
            pattern.CheckNotNull(nameof(pattern));

            return(should.Satisfy(actual => actual != null && Regex.IsMatch(actual, pattern), $"match pattern \"{pattern}\""));
        }
示例#12
0
        public static TOwner EndWith <TOwner>(this IDataVerificationProvider <string, TOwner> should, string expected)
        {
            expected.CheckNotNull(nameof(expected));

            return(should.Satisfy(actual => actual != null && actual.EndsWith(expected), "end with {0}", expected));
        }
示例#13
0
        public static TOwner ContainIgnoringCase <TOwner>(this IDataVerificationProvider <string, TOwner> should, string expected)
        {
            expected.CheckNotNull(nameof(expected));

            return(should.Satisfy(actual => actual != null && actual.ToUpper().Contains(expected.ToUpper()), "contain {0} ignoring case", expected));
        }
示例#14
0
 public static TOwner BeFalse <TOwner>(this IDataVerificationProvider <bool, TOwner> should)
 {
     return(should.Satisfy(actual => !actual, "be false"));
 }
示例#15
0
 public static TOwner BeLess <TData, TOwner>(this IDataVerificationProvider <TData, TOwner> should, TData expected)
     where TData : IComparable <TData>, IComparable
     where TOwner : PageObject <TOwner>
 {
     return(should.Satisfy(actual => actual != null && actual.CompareTo(expected) < 0, "be less than {0}", expected));
 }
示例#16
0
 /// <summary>
 /// Verifies that collection contains a single item equal to <paramref name="expected"/> parameter.
 /// </summary>
 /// <typeparam name="TData">The type of the collection item data.</typeparam>
 /// <typeparam name="TOwner">The type of the owner.</typeparam>
 /// <param name="should">The should instance.</param>
 /// <param name="expected">An expected data value.</param>
 /// <returns>The owner instance.</returns>
 public static TOwner ContainSingle <TData, TOwner>(this IDataVerificationProvider <IEnumerable <IDataProvider <TData, TOwner> >, TOwner> should, TData expected)
 {
     return(should.Satisfy(
                actual => actual != null && actual.Count((TData x) => Equals(x, expected)) == 1,
                $"contain single {Stringifier.ToString(expected)}"));
 }
示例#17
0
 public static TOwner BeLessOrEqual <TData, TOwner>(this IDataVerificationProvider <TData?, TOwner> should, TData expected)
     where TData : struct, IComparable <TData>, IComparable
     where TOwner : PageObject <TOwner>
 {
     return(should.Satisfy(actual => actual != null && actual.Value.CompareTo(expected) <= 0, "be less than or equal to {0}", expected));
 }
示例#18
0
 /// <summary>
 /// Verifies that collection is sorted in descending order.
 /// </summary>
 /// <typeparam name="TData">The type of the collection item data.</typeparam>
 /// <typeparam name="TOwner">The type of the owner.</typeparam>
 /// <param name="verifier">The verification provider.</param>
 /// <returns>The owner instance.</returns>
 public static TOwner BeInDescendingOrder <TData, TOwner>(this IDataVerificationProvider <IEnumerable <IDataProvider <TData, TOwner> >, TOwner> verifier)
 {
     return(verifier.Satisfy(
                (IEnumerable <TData> actual) => actual != null && actual.OrderByDescending(x => x).SequenceEqual(actual),
                "be in descending order"));
 }
示例#19
0
 public static TOwner EqualDate <TOwner>(this IDataVerificationProvider <DateTime?, TOwner> should, DateTime expected)
     where TOwner : PageObject <TOwner>
 {
     return(should.Satisfy(actual => actual != null && Equals(actual.Value.Date, expected.Date), "equal date {0}", expected));
 }
 public static TOwner HaveLength <TOwner>(this IDataVerificationProvider <string, TOwner> should, int expected)
     where TOwner : PageObject <TOwner>
 {
     return(should.Satisfy(actual => actual != null && actual.Length == expected, $"have length of {expected}"));
 }
示例#21
0
 public static TOwner HaveCount <TData, TOwner>(this IDataVerificationProvider <IEnumerable <TData>, TOwner> should, int expected)
     where TOwner : PageObject <TOwner>
 {
     return(should.Satisfy(actual => actual != null && actual.Count() == expected, $"have count {expected}"));
 }
 /// <summary>
 /// Verifies that collection contains only a single item.
 /// </summary>
 /// <typeparam name="TItem">The type of the collection item.</typeparam>
 /// <typeparam name="TOwner">The type of the owner.</typeparam>
 /// <param name="should">The should instance.</param>
 /// <returns>The owner instance.</returns>
 public static TOwner ContainSingle <TItem, TOwner>(this IDataVerificationProvider <IEnumerable <TItem>, TOwner> should)
     where TOwner : PageObject <TOwner>
 {
     return(should.Satisfy(actual => actual != null && actual.Count() == 1, $"contain single item"));
 }
示例#23
0
 public static TOwner BeLessDateTime <TOwner>(this IDataVerificationProvider <DateTime, TOwner> should, DateTime expected)
     where TOwner : PageObject <TOwner>
 {
     return(should.Satisfy(actual => DateTime.Compare(actual, expected) < 0, "be less than date {0}", expected));
 }
示例#24
0
 public static TOwner BeNullOrWhiteSpace <TOwner>(this IDataVerificationProvider <string, TOwner> should)
     where TOwner : PageObject <TOwner>
 {
     return(should.Satisfy(actual => string.IsNullOrWhiteSpace(actual), "be null or white-space"));
 }
 public static TOwner Equal <TData, TOwner>(this IDataVerificationProvider <TData, TOwner> should, TData expected)
     where TOwner : PageObject <TOwner>
 {
     return(should.Satisfy(actual => Equals(actual, expected), "equal {0}", expected));
 }
示例#26
0
 public static TOwner EqualIgnoringCase <TOwner>(this IDataVerificationProvider <string, TOwner> should, string expected)
     where TOwner : PageObject <TOwner>
 {
     return(should.Satisfy(actual => string.Equals(expected, actual, StringComparison.CurrentCultureIgnoreCase), "equal {0} ignoring case", expected));
 }
 public static TOwner BeFalse <TOwner>(this IDataVerificationProvider <bool?, TOwner> should)
     where TOwner : PageObject <TOwner>
 {
     return(should.Satisfy(actual => actual == false, "be false"));
 }
示例#28
0
 public static TOwner BeGreaterOrEqual <TData, TOwner>(this IDataVerificationProvider <TData, TOwner> should, TData expected)
     where TData : IComparable <TData>, IComparable
     where TOwner : PageObject <TOwner>
 {
     return(should.Satisfy(actual => actual != null && actual.CompareTo(expected) >= 0, "be greater than or equal to {0}", expected));
 }
 public static TOwner BeNullOrEmpty <TOwner>(this IDataVerificationProvider <string, TOwner> should)
     where TOwner : PageObject <TOwner>
 {
     return(should.Satisfy(actual => string.IsNullOrEmpty(actual), "be null or empty"));
 }
示例#30
0
        public static TOwner StartWith <TOwner>(this IDataVerificationProvider <string, TOwner> should, string expected)
        {
            expected.CheckNotNull(nameof(expected));

            return(should.Satisfy(actual => actual != null && actual.StartsWith(expected, StringComparison.CurrentCulture), "start with {0}", expected));
        }