Example #1
0
        string jsonConvert(this MapMethod me)
        {
            switch (me)
            {
            case MapMethod.Click:
                return("click-element");

            case MapMethod.Frame:
                return("frame");

            case MapMethod.Input:
                return("input-element");

            case MapMethod.IsElement:
                return("is-element");

            case MapMethod.SelectElement:
                return("select-element");

            case MapMethod.SqlQuery:
                return("sql-query");

            default:
                return("null");
            }
        }
Example #2
0
 public static TTarget Map(TSource source)
 {
     if (mapMethod == null)
     {
         mapMethod = CreateMapMethod(typeof(TTarget), typeof(TSource));
     }
     return(mapMethod(source));
 }
Example #3
0
 public static MapMethod <TTarget, TSource> GetMapMethod()
 {
     if (mapMethod == null)
     {
         mapMethod = CreateMapMethod(typeof(TTarget), typeof(TSource));
     }
     return(mapMethod);
 }
Example #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="eventActivity"></param>
        /// <param name="elementFound"></param>
        /// <returns></returns>
        public static JToken readJSON(MapMethod eventActivity, string elementFound)
        {
            JToken  foundElement = null;
            var     json         = File.ReadAllText(BASE_PATH + MapMethodTyper.jsonConvert(eventActivity) + BASE_EXT);
            JObject objects      = JObject.Parse(json);

            foundElement = objects.GetValue(clearTurkishCharsAndUpperCase(elementFound));
            Assert.IsFalse(foundElement == null, elementFound + " is not found in " + Mapping.MapMethodTyper.jsonConvert(eventActivity) + " file");
            return(foundElement);
        }
Example #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="eventActivity"></param>
        /// <param name="queryFound"></param>
        /// <returns></returns>
        public static IList <String> foundSQLActivity(MapMethod eventActivity, string queryFound)
        {
            var    set        = new List <String>();
            JToken foundToken = readJSON(eventActivity, queryFound);

            foreach (JToken jobject in foundToken)
            {
                JProperty typeProperty = (JProperty)jobject;
                if (typeProperty.Name.Equals("query"))
                {
                    set.Add(typeProperty.Value.ToString());
                }
            }
            return(set);
        }
Example #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="eventActivity"></param>
        /// <param name="elementFound"></param>
        /// <returns></returns>
        public static IDictionary <By, int> foundActivity(MapMethod eventActivity, string elementFound)
        {
            var    set        = new Dictionary <By, int>();
            By     by         = null;
            int    index      = -1;
            JToken foundToken = readJSON(eventActivity, elementFound);

            foreach (JToken jobject in foundToken)
            {
                JProperty typeProperty = (JProperty)jobject;
                if (typeProperty.Name.Equals("index"))
                {
                    int intIndex = (Int32)typeProperty.Value;
                    index = intIndex;
                }
                else
                {
                    by = generateByElement(typeProperty.Name, typeProperty.Value.ToString());
                }
            }
            set.Add(by, index);
            return(set);
        }
Example #7
0
        /// <summary>
        /// By return from Json
        /// </summary>
        /// <param name="activity"></param>
        /// <param name="text"></param>
        /// <returns></returns>
        public By getElementFromJSON(MapMethod activity, string text)
        {
            List <By> byList = new List <By>(Mapper.foundActivity(activity, text).Keys);

            return(byList[0]);
        }