Beispiel #1
0
        /// <summary>
        /// 执行操作
        /// </summary>
        /// <typeparam name="TAction"></typeparam>
        /// <param name="args"></param>
        /// <returns></returns>
        public WebSelenium Do <TAction>(params object[] args)
            where TAction : UserAction
        {
            List <object> list = new List <object> {
                this
            };

            list.AddRange(args);
            TAction action = Activator.CreateInstance(typeof(TAction), list.ToArray()) as TAction;

            return(Do(action.Description, () => action.Run()));
        }
Beispiel #2
0
        /// <summary>
        /// 执行校验
        /// </summary>
        /// <typeparam name="TAction"></typeparam>
        /// <param name="args"></param>
        /// <returns></returns>
        public WebSelenium Check <TAction>(params object[] args)
            where TAction : UserAction
        {
            TAction action = Activator.CreateInstance(typeof(TAction), this, args) as TAction;

            Tracker.Log(TrackTag.Assert, action.Description);
            if (EnvManager.Auto)
            {
                action.Run();
            }
            Tracker.Log(TrackTag.UserEnd, "");
            return(this);
        }
Beispiel #3
0
        /// <summary>
        /// 执行前置条件
        /// </summary>
        /// <typeparam name="TAction"></typeparam>
        /// <param name="args"></param>
        /// <returns></returns>
        public WebSelenium When <TAction>(params object[] args)
            where TAction : UserAction
        {
            List <object> list = new List <object>();

            list.Add(this);
            list.AddRange(args);
            TAction action = Activator.CreateInstance(typeof(TAction), list.ToArray()) as TAction;

            Tracker.Log(TrackTag.Condition, action.Description);
            if (EnvManager.Auto)
            {
                action.Run();
            }
            Tracker.Log(TrackTag.UserEnd, "");
            return(this);
        }