Exemplo n.º 1
0
        public void MergeWith(ITermSettings otherTermSettings)
        {
            otherTermSettings.CheckNotNull("otherTermSettings");

            if (otherTermSettings.Case != TermCase.Inherit)
                Case = otherTermSettings.Case;

            if (otherTermSettings.Match != TermMatch.Inherit)
                Match = otherTermSettings.Match;

            if (otherTermSettings.Format != null)
                Format = otherTermSettings.Format;
        }
Exemplo n.º 2
0
 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>
 {
     return(should.ContainHavingContent(match, expected.AsEnumerable()));
 }
 protected VerifyHeadingTriggerAttribute(TermMatch match, TermCase termCase = TermCase.Inherit)
     : base(match, termCase)
 {
 }
 public TermFindSettingsAttribute(FindTermBy by, TermMatch match = TermMatch.Inherit, TermCase termCase = TermCase.Inherit)
     : this(by.ResolveFindAttributeType(), match, termCase)
 {
 }
Exemplo n.º 5
0
 public FindByTitleAttribute(TermMatch match, params string[] values)
     : base(match, values)
 {
 }
Exemplo n.º 6
0
 public TermAttribute(TermMatch match, params string[] values)
     : this(values, match)
 {
 }
        public static TOwner MatchAny <TOwner>(this IDataVerificationProvider <string, TOwner> should, TermMatch match, params string[] expected)
            where TOwner : PageObject <TOwner>
        {
            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));
        }
Exemplo n.º 8
0
 public VerifyH2Attribute(TermMatch match, params string[] values)
     : base(match, values)
 {
 }
Exemplo n.º 9
0
 public FindItemByRelativeElementContentAttribute(string relativeElementXPath, TermMatch match, TermCase termCase)
     : base(match, termCase)
 {
     RelativeElementXPath = relativeElementXPath;
 }
Exemplo n.º 10
0
 public SelectByTextAttribute(TermMatch match, TermCase termCase)
     : base(match, termCase)
 {
 }
 public FindByContentOrValueAttribute(TermMatch match, TermCase termCase = TermCase.Inherit)
     : base(match, termCase)
 {
 }
Exemplo n.º 12
0
 public SelectByTextAttribute(TermMatch match)
     : base(match)
 {
 }
Exemplo n.º 13
0
 public FindByContentOrValueAttribute(TermMatch match, params string[] values)
     : base(match, values)
 {
 }
Exemplo n.º 14
0
 public FindByContentOrValueAttribute(TermMatch match, TermCase termCase)
     : base(match, termCase)
 {
 }
Exemplo n.º 15
0
 protected TermFindAttribute(string[] values = null, TermMatch match = TermMatch.Inherit, TermCase termCase = TermCase.Inherit)
 {
     Values = values;
     Match = match;
     Case = termCase;
 }
Exemplo n.º 16
0
 protected TermFindAttribute(TermMatch match, TermCase termCase)
     : this()
 {
     Match = match;
     Case  = termCase;
 }
 protected TermVerificationTriggerAttribute(TermMatch match, params string[] values)
     : this(values)
 {
     Match = match;
 }
Exemplo n.º 18
0
 protected TermFindAttribute(TermMatch match, params string[] values)
     : this(values)
 {
     Match = match;
 }
Exemplo n.º 19
0
        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)} {CollectionToString(expected)}"));
        }
Exemplo n.º 20
0
 public FindItemByPrecedingSiblingContentAttribute(TermMatch match, TermCase termCase)
     : base(PrecedingSiblingElementXPath, match, termCase)
 {
 }
 public FindByChildContentAttribute(TermMatch match, TermCase termCase = TermCase.Inherit)
     : base(match, termCase)
 {
 }
Exemplo n.º 22
0
 public WindowTitleAttribute(TermMatch match, TermCase termCase = DefaultCase)
     : this(null, match, termCase)
 {
 }
Exemplo n.º 23
0
 public FindByContentAttribute(TermMatch match, params string[] values)
     : base(match, values)
 {
 }
Exemplo n.º 24
0
 public WindowTitleAttribute(TermMatch match, params string[] values)
     : this(values, match)
 {
 }
Exemplo n.º 25
0
 public SelectByValueAttribute(TermMatch match = TermMatch.Inherit, TermCase termCase = TermCase.Inherit)
     : base(match, termCase)
 {
 }
Exemplo n.º 26
0
 private WindowTitleAttribute(string[] values = null, TermMatch match = DefaultMatch, TermCase termCase = DefaultCase)
 {
     Values = values;
     Match = match;
     Case = termCase;
 }
 public FindItemByValueAttribute(TermMatch match = TermMatch.Inherit, TermCase termCase = TermCase.Inherit)
     : base(match, termCase)
 {
 }
Exemplo n.º 28
0
 public FindItemByLabelAttribute(TermMatch match)
     : base(match)
 {
 }
 public FindByAttributeAttribute(string attributeName, TermMatch match, params string[] values)
     : this(attributeName, values, match)
 {
 }
Exemplo n.º 30
0
 public FindItemByLabelAttribute(TermMatch match, TermCase termCase)
     : base(match, termCase)
 {
 }
Exemplo n.º 31
0
 protected TermFindAttribute(TermMatch match, params string[] values)
     : this(values, match)
 {
 }
Exemplo n.º 32
0
        public static bool IsMatch(this TermMatch match, string text, params string[] terms)
        {
            var predicate = match.GetPredicate();

            return(terms.Any(term => predicate(text, term)));
        }
 protected TermVerificationTriggerAttribute(TermMatch match, TermCase termCase)
     : this()
 {
     Match = match;
     Case  = termCase;
 }
 public FindByDescriptionTermAttribute(TermMatch match, TermCase termCase)
     : base(match, termCase)
 {
 }
Exemplo n.º 35
0
 public VerifyH2Attribute(TermMatch match, TermCase termCase)
     : base(match, termCase)
 {
 }
 public FindByDescriptionTermAttribute(TermMatch match, params string[] values)
     : base(match, values)
 {
 }
Exemplo n.º 37
0
        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 => 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)}"));
        }
Exemplo n.º 38
0
 public bool Excludes(TermMatch match)
 {
     return(match.Term == _exclusion.Term &&
            MatchFinder.RangeContains(_line, _column, _line, _column + _exclusion.Text.Length - 1, match.Line, match.Column) &&
            MatchFinder.RangeContains(_line, _column, _line, _column + _exclusion.Text.Length - 1, match.Line, match.Column + match.Term.Term.Text.Length - 1));
 }
 public VerifyTitleSettingsAttribute(TermMatch match, TermCase termCase = TermCase.Inherit)
     : base(match, termCase)
 {
 }
Exemplo n.º 40
0
 void RemoveAllMatchesInRangeExceptOne(int lineStart, int columnStart, int lineEnd, int columnEnd, TermMatch matchToSave)
 {
     foreach (TermMatch match in PartiallyMatchedTerms)
     {
         if (match != matchToSave && RangesOverlap(lineStart, columnStart, lineEnd, columnEnd, match.Line, match.Column, match.Line, match.Column + match.Term.Term.Text.Length - 1))
         {
             match.MarkForDiscard();
         }
     }
 }
Exemplo n.º 41
0
 protected TermFindItemAttribute(TermMatch match = TermMatch.Inherit, TermCase termCase = TermCase.Inherit)
 {
     Match = match;
     Case = termCase;
 }
Exemplo n.º 42
0
 protected TermFindItemAttribute(TermMatch match)
 {
     Match = match;
 }
Exemplo n.º 43
0
 public TermAttribute(TermMatch match, TermCase termCase = TermCase.Inherit)
     : this(null, match, termCase)
 {
 }
Exemplo n.º 44
0
 protected TermFindItemAttribute(TermMatch match, TermCase termCase)
 {
     Match = match;
     Case  = termCase;
 }
Exemplo n.º 45
0
 private TermAttribute(string[] values = null, TermMatch match = TermMatch.Inherit, TermCase termCase = TermCase.Inherit)
 {
     Values = values;
     Match = match;
     Case = termCase;
 }
 public SelectsOptionByLabelAttributeAttribute(TermMatch match)
     : base(LabelAttributeName, match)
 {
 }
Exemplo n.º 47
0
 public FindByTitleAttribute(TermMatch match, TermCase termCase = TermCase.Inherit)
     : base(match, termCase)
 {
 }
 public SelectsOptionByLabelAttributeAttribute(TermMatch match, TermCase termCase)
     : base(LabelAttributeName, match, termCase)
 {
 }
Exemplo n.º 49
0
 // Collapse together subsequent matches for same value or value has same range as no preference
 internal static IEnumerable<TermMatch> Coalesce(IEnumerable<TermMatch> matches, string input)
 {
     var sorted = (from match in matches
                   orderby match.Start ascending
                   , match.End ascending
                   , match.Value == null ascending
                   select match).ToList();
     while (sorted.Count() > 0)
     {
         var current = sorted.First();
         sorted.Remove(current);
         bool emit = true;
         foreach (var next in sorted.ToList())
         {
             if (next.Covers(current))
             {
                 // Current is completely covered by a subsequent match
                 emit = false;
                 break;
             }
             else if (current.End < next.Start)
             {
                 var gap = next.Start - current.End;
                 if (gap > 1 && !Language.NonWord(input.Substring(current.End, gap)))
                 {
                     // Unmatched word means we can't merge any more
                     emit = true;
                     break;
                 }
                 else if (current.Value == next.Value || IsSpecial(current.Value) || IsSpecial(next.Value))
                 {
                     // Compatible, extend current match
                     current = new TermMatch(current.Start, next.End - current.Start, Math.Max(current.Confidence, next.Confidence),
                                 IsSpecial(current.Value) ? next.Value : current.Value);
                     sorted.Remove(next);
                 }
             }
             else if (next.Value == null && current.Overlaps(next))
             {
                 // Remove no preference if there is any overlapping meaning
                 sorted.Remove(next);
             }
         }
         if (emit && !IsSpecial(current.Value))
         {
             sorted = (from match in sorted where !current.Covers(match) select match).ToList();
             yield return current;
         }
     }
 }
Exemplo n.º 50
0
 public FindByClassAttribute(TermMatch match, TermCase termCase)
     : base(match, termCase)
 {
 }
Exemplo n.º 51
0
 protected SelectByAttribute(TermMatch match = TermMatch.Inherit, TermCase termCase = TermCase.Inherit)
 {
     Match = match;
     Case = termCase;
 }
Exemplo n.º 52
0
 public FindByClassAttribute(TermMatch match, params string[] values)
     : base(match, values)
 {
 }
 public TermFindSettingsAttribute(Type findAttributeType, TermMatch match = TermMatch.Inherit, TermCase termCase = TermCase.Inherit)
     : base(findAttributeType)
 {
     Match = match;
     Case = termCase;
 }
 public FindByPlaceholderAttribute(TermMatch match, TermCase termCase = TermCase.Inherit)
     : base(match, termCase)
 {
 }
 protected VerifyHeadingTriggerAttribute(TermMatch match, params string[] values)
     : base(match, values)
 {
 }
 public FindByPlaceholderAttribute(TermMatch match, params string[] values)
     : base(match, values)
 {
 }
 public FindByAttributeAttribute(string attributeName, TermMatch match, TermCase termCase = TermCase.Inherit)
     : this(attributeName, null, match, termCase)
 {
 }
Exemplo n.º 58
0
 protected TermFindAttribute(TermMatch match, TermCase termCase = TermCase.Inherit)
     : this(null, match, termCase)
 {
 }
 private FindByAttributeAttribute(string attributeName, string[] values = null, TermMatch match = TermMatch.Inherit, TermCase termCase = TermCase.Inherit)
     : base(values, match, termCase)
 {
     AttributeName = attributeName.CheckNotNullOrWhitespace(nameof(attributeName));
 }
Exemplo n.º 60
0
 public static TOwner Contain <TOwner>(this IDataVerificationProvider <IEnumerable <IDataProvider <string, TOwner> >, TOwner> should, TermMatch match, params string[] expected)
 {
     return(should.Contain(match, expected.AsEnumerable()));
 }