示例#1
0
        public PageObjectValidationBase <T> SetExceptionField(Func <T, By> selector)
        {
            T page = (T)Convert.ChangeType(PageBase, typeof(T));

            ExceptionFields.Add(selector(page));
            return(this);
        }
示例#2
0
        public PageObjectValidationBase <T> SetExceptionField(string fieldLabel)
        {
            var props    = PageBase.GetType().GetProperties(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public).Where(p => Attribute.IsDefined(p, typeof(DescriptionAttribute))).ToList();
            var property = props.FirstOrDefault(p =>
            {
                var descAttrib = (DescriptionAttribute)Attribute.GetCustomAttribute(p, typeof(DescriptionAttribute));
                return(descAttrib != null && descAttrib.Description.Equals(fieldLabel));
            });

            if (property != null)
            {
                ExceptionFields.Add(property.GetValue(PageBase) as By);
            }

            return(this);
        }
示例#3
0
 public PageObjectValidationBase <T> ClearExceptionFields()
 {
     ExceptionFields.Clear();
     return(this);
 }