Beispiel #1
0
        public bool RuntimeValidation(ref string error)
        {
            var total = 0;

            if (this.ContainsBoth)
            {
                this.CurrentContainsType = RegionUtilityComponent.ContainsType.Both;
                total++;
            }
            if (this.ContainsNone)
            {
                this.CurrentContainsType = RegionUtilityComponent.ContainsType.None;
                total++;
            }
            if (this.ContainsOne)
            {
                this.CurrentContainsType = RegionUtilityComponent.ContainsType.One;
                total++;
            }
            if (this.ExclusiveOr)
            {
                this.CurrentContainsType = RegionUtilityComponent.ContainsType.ExclusiveOr;
                total++;
            }
            if (total != 1)
            {
                error = "In '" + this.Name + "', exactly one of the Contains parameters must be set to true!";
                return(false);
            }
            return(this.SubRuntimeValidation(ref error));
        }
Beispiel #2
0
 /// <summary>
 /// Gibt an ob entweder ein zeichen, oder alle Zeichen aus <paramref name="chars"/> im String <paramref name="s"/> enthalten sind
 /// </summary>
 public static bool Contains(this string s, ContainsType type, params char[] chars)
 {
     if (type == ContainsType.Any)
     {
         return(chars.Any(s.Contains));
     }
     return(chars.All(s.Contains));
 }
Beispiel #3
0
 /// <summary>
 /// Gibt an ob entweder ein zeichen, oder alle Zeichen aus <paramref name="values"/> im String <paramref name="s"/> enthalten sind
 /// </summary>
 public static bool Contains(this string s, ContainsType type, params string[] values)
 {
     if (type == ContainsType.Any)
     {
         return(values.Any(s.Contains));
     }
     return(values.All(s.Contains));
 }
Beispiel #4
0
 public static void WaitFor(this AppiumDriver driver, ContainsType _ContainsType, double time = 10)
 {
     Stopwatch watch = new Stopwatch ();
     watch.Start ();
     while (watch.Elapsed.TotalSeconds < time) {
         driver.Sleep (0.5);
         if (_ContainsType ())
             break;
     }
     watch.Stop ();
     if (watch.Elapsed.TotalSeconds >= time)
         throw new Exception(string.Format("Item does not exist after {0} seconds of waiting", time));
 }
Beispiel #5
0
 public bool RuntimeValidation(ref string error)
 {
     var total = 0;
     if ( this.ContainsBoth )
     {
         this.CurrentContainsType = RegionUtilityComponent.ContainsType.Both;
         total++;
     }
     if ( this.ContainsNone )
     {
         this.CurrentContainsType = RegionUtilityComponent.ContainsType.None;
         total++;
     }
     if ( this.ContainsOne )
     {
         this.CurrentContainsType = RegionUtilityComponent.ContainsType.One;
         total++;
     }
     if ( this.ExclusiveOr )
     {
         this.CurrentContainsType = RegionUtilityComponent.ContainsType.ExclusiveOr;
         total++;
     }
     if ( total != 1 )
     {
         error = "In '" + this.Name + "', exactly one of the Contains parameters must be set to true!";
         return false;
     }
     return this.SubRuntimeValidation( ref error );
 }