private void getAndConditions(string name, string automationId, string className, string controlType) { ResultAndCondition = null; var cmdlet = new GetControlCmdletBase {Name = name, AutomationId = automationId, Class = className, CaseSensitive = false }; var common = new CommonCmdletBase(); // 20131128 //ResultAndCondition = // (common.GetControlConditionsForWildcardSearch(cmdlet, controlType, cmdlet.CaseSensitive, true) as AndCondition); // 20131129 // ResultAndCondition = // (common.GetControlConditionsForWildcardSearch(cmdlet, controlType, cmdlet.CaseSensitive)); ResultAndCondition = // common.GetWildcardSearchCondition(cmdlet) as AndCondition; ControlSearcher.GetWildcardSearchCondition( new ControlSearcherData { Name = name, AutomationId = automationId, Class = className, CaseSensitive = false }) as AndCondition; }
protected internal void WriteDebug(CommonCmdletBase cmdlet, object obj) { string reportString = CmdletSignature(cmdlet) + obj; WriteLog(LogLevels.Debug, reportString); }
protected internal void WriteWarn(CommonCmdletBase cmdlet, string text) { string reportString = CmdletSignature(cmdlet) + text; // 20140317 // turning off the logger // Logger.Warn(reportString); }
internal static T GetCommand <T>(CommonCmdletBase cmdlet) { try { T newCommand = default(T); var cmdletParam = new ConstructorArgument("cmdlet", cmdlet); newCommand = Kernel.Get <T>(cmdletParam); return(ConvertToProxiedCommand <T>(newCommand, cmdlet)); } catch (Exception) { // TODO // write error to error object!!! // Console.WriteLine("Command 01"); // Console.WriteLine(eCommand.Message); return(default(T)); } }
internal virtual string GetObjectPropertiesInfo(CommonCmdletBase cmdlet) { string result = string.Empty; // http://stackoverflow.com/questions/2281972/how-to-get-a-list-of-properties-with-a-given-attribute foreach (PropertyInfo propertyInfo in cmdlet.GetType() .GetProperties(BindingFlags.Public | BindingFlags.Instance) .Where(p => p.GetCustomAttributes(typeof(UiaParameterAttribute), true).Length != 0)) { result += GetPropertyString(cmdlet, propertyInfo); } result = cmdlet.CmdletName(cmdlet) + result; return result; }
internal virtual string GetObjectPropertiesInfo(CommonCmdletBase cmdlet) { string result = string.Empty; // http://stackoverflow.com/questions/2281972/how-to-get-a-list-of-properties-with-a-given-attribute foreach (PropertyInfo propertyInfo in cmdlet.GetType() .GetProperties(BindingFlags.Public | BindingFlags.Instance) .Where(p => p.GetCustomAttributes(typeof(UiaParameterAttribute), true).Length != 0)) { result += GetPropertyString(cmdlet, propertyInfo); } result = cmdlet.CmdletName(cmdlet) + result; return(result); }
private void getOrConditions(string searchString, string controlType) { ResultOrCondition = null; GetControlCmdletBase cmdlet = new GetControlCmdletBase {ContainsText = searchString }; CommonCmdletBase common = new CommonCmdletBase(); // 20131129 // ResultOrCondition = // (common.GetControlConditionsForExactSearch(cmdlet, controlType, cmdlet.CaseSensitive, false) as OrCondition); ResultOrCondition = // common.GetTextSearchCondition(searchString, new string[] { controlType }, cmdlet.CaseSensitive) as OrCondition; ControlSearcher.GetTextSearchCondition(searchString, new string[] { controlType }, cmdlet.CaseSensitive) as OrCondition; }
private void checkConditionsArray( string controlType, string controlTypeProperty, string controlTypeValue) { Condition[] conditions = null; cmdlet = new UIAutomation.Commands.GetUiaControlCommand(); cmdletBase = new GetControlCmdletBase(); Condition condition = // cmdlet.GetWildcardSearchCondition(cmdlet); ControlSearcher.GetWildcardSearchCondition( new ControlSearcherData { // completely new Name = cmdlet.Name, AutomationId = cmdlet.AutomationId, Class = cmdlet.Class, Value = cmdlet.Value, ControlType = cmdlet.ControlType }); // 20140630 // conditions = ((AndCondition)condition).GetConditions(); if (null != condition as AndCondition) { conditions = ((AndCondition)condition).GetConditions(); } else if (null != condition as OrCondition) { conditions = ((OrCondition)condition).GetConditions(); } else { conditions = new[] { condition }; } foreach (Condition cond in conditions) { if ((cond as PropertyCondition) != null) { MbUnit.Framework.Assert.AreEqual( controlTypeProperty, (cond as PropertyCondition).Property.ProgrammaticName); MbUnit.Framework.Assert.AreEqual( controlTypeValue, (cond as PropertyCondition).Value.ToString()); } else { MbUnit.Framework.Assert.AreEqual(cond, Condition.TrueCondition); } } }
internal static T ConvertToProxiedCommand <T>(T commandToConvert, CommonCmdletBase cmdlet) { T proxiedObject = default(T); try { proxiedObject = (T)_generator.CreateClassProxy( typeof(T), new CommonCmdletBase[] { cmdlet }, // 20140228 // new LoggingAspect(), new InputValidationAspect(), new ErrorHandlingAspect(), new HighlighterAspect(), new TestResultAspect()); new LoggingAspect(), new InputValidationAspect(), new ErrorHandlingAspect(), new HighlighterAspect(), new TestResultAspect(), new FaultInjectionAspect()); } catch (Exception) { // Console.WriteLine("ProxiedObject"); // Console.WriteLine(eProxying.Message); } return(proxiedObject); }
protected internal void WriteInfo(CommonCmdletBase cmdlet, string text) { if (!string.IsNullOrEmpty(text) && !string.IsNullOrEmpty(text.Trim())) { string reportString = CmdletSignature(cmdlet) + text; // 20140317 // turning off the logger // Logger.Info(reportString); } else { // 20140317 // turning off the logger // Logger.Info(text); } }
public virtual void LogCmdlet(CommonCmdletBase cmdlet) { Info(GetObjectPropertiesInfo(cmdlet)); }
internal UIAAddWizardStepCommand(CommonCmdletBase cmdlet) : base(cmdlet) { }
public NewWizardCommand(CommonCmdletBase cmdlet) : base (cmdlet) { }
protected internal void WriteWarn(CommonCmdletBase cmdlet, string text) { string reportString = CmdletSignature(cmdlet) + text; TMX.Logger.Warn(reportString); }
internal UIACommand(CommonCmdletBase cmdlet) { this.Cmdlet = cmdlet; }
private void getConditions(string name, string automationId, string className, string controlType) { this.ResultCondition = null; GetControlCmdletBase cmdlet = new GetControlCmdletBase(); cmdlet.Name = name; cmdlet.AutomationId = automationId; cmdlet.Class = className; UIAutomation.CommonCmdletBase common = new UIAutomation.CommonCmdletBase(); this.ResultCondition = (common.getControlConditions(cmdlet, controlType, cmdlet.CaseSensitive, true) as AndCondition); }
protected internal void WriteDebug(CommonCmdletBase cmdlet, object obj) { string reportString = CmdletSignature(cmdlet) + obj.ToString(); WriteLog(reportString); }
public NewRemoteDesktopProtocolFileCommand(CommonCmdletBase cmdlet) : base (cmdlet) { }
internal virtual string GetPropertyString(CommonCmdletBase cmdlet, PropertyInfo propertyInfo) { string result = string.Empty; if (null == propertyInfo) return result; object tempResult = string.Empty; try { tempResult = propertyInfo.GetValue(cmdlet, null) ?? string.Empty; } catch (Exception) { return string.Empty; } if (string.IsNullOrEmpty(tempResult.ToString())) return result; result += " -"; result += propertyInfo.Name; result += " "; string tempString = string.Empty; switch (tempResult.GetType().Name) { case "String": result += "\""; result += tempResult; result += "\""; return result; case "String[]": tempString = string.Empty; foreach (string singleElement in tempResult as IEnumerable) { tempString += ","; tempString += singleElement; } if (0 < tempString.Length) tempString = tempString.Substring(1); result += tempString; return result; case "IUiElement": var convertCmdlet = new ConvertToUiaSearchCriteriaCommand { Full = true }; // result += "\r\n\t"; result += convertCmdlet.ConvertElementToSearchCriteria((IUiElement)tempResult); // result += "\r\n\t"; return result; case "IUiElement[]": var convertCmdlet2 = new ConvertToUiaSearchCriteriaCommand { Full = true }; foreach (IUiElement element in tempResult as IUiElement[]) { // result += "\r\n\t"; result += convertCmdlet2.ConvertElementToSearchCriteria(element); // result += "\r\n\t"; } return result; case "Int32": result += tempResult.ToString(); return result; case "SwitchParameter": bool tempBool = (SwitchParameter)tempResult; result += tempBool ? "$true" : "$false"; return result; case "Hashtable": result += ConvertHashtableToString((Hashtable)tempResult); return result; case "Hashtable[]": tempString = string.Empty; foreach (Hashtable hashtable in (tempResult as Hashtable[])) { tempString += ","; tempString += ConvertHashtableToString(hashtable); } if (0 < tempString.Length) tempString = tempString.Substring(1); result += tempString; return result; default: result += tempResult.ToString(); return result; } }
protected internal void WriteDebug(CommonCmdletBase cmdlet, string text) { string reportString = CmdletSignature(cmdlet) + text; // 20130501 //WriteLog(reportString); this.WriteLog(LogLevels.Debug, reportString); }
protected internal void WriteDebug(CommonCmdletBase cmdlet, object obj) { string reportString = CmdletSignature(cmdlet) + obj.ToString(); // 20130501 //WriteLog(reportString); this.WriteLog(LogLevels.Debug, reportString); }
internal virtual string GetPropertyString(CommonCmdletBase cmdlet, PropertyInfo propertyInfo) { string result = string.Empty; if (null == propertyInfo) { return(result); } object tempResult = string.Empty; try { tempResult = propertyInfo.GetValue(cmdlet, null) ?? string.Empty; } catch (Exception) { return(string.Empty); } if (string.IsNullOrEmpty(tempResult.ToString())) { return(result); } result += " -"; result += propertyInfo.Name; result += " "; string tempString = string.Empty; switch (tempResult.GetType().Name) { case "String": result += "\""; result += tempResult; result += "\""; return(result); case "String[]": tempString = string.Empty; foreach (string singleElement in tempResult as IEnumerable) { tempString += ","; tempString += singleElement; } if (0 < tempString.Length) { tempString = tempString.Substring(1); } result += tempString; return(result); case "IUiElement": var convertCmdlet = new ConvertToUiaSearchCriteriaCommand { Full = true }; // result += "\r\n\t"; result += convertCmdlet.ConvertElementToSearchCriteria((IUiElement)tempResult); // result += "\r\n\t"; return(result); case "IUiElement[]": var convertCmdlet2 = new ConvertToUiaSearchCriteriaCommand { Full = true }; foreach (IUiElement element in tempResult as IUiElement[]) { // result += "\r\n\t"; result += convertCmdlet2.ConvertElementToSearchCriteria(element); // result += "\r\n\t"; } return(result); case "Int32": result += tempResult.ToString(); return(result); case "SwitchParameter": bool tempBool = (SwitchParameter)tempResult; result += tempBool ? "$true" : "$false"; return(result); case "Hashtable": result += ConvertHashtableToString((Hashtable)tempResult); return(result); case "Hashtable[]": tempString = string.Empty; foreach (Hashtable hashtable in (tempResult as Hashtable[])) { tempString += ","; tempString += ConvertHashtableToString(hashtable); } if (0 < tempString.Length) { tempString = tempString.Substring(1); } result += tempString; return(result); default: result += tempResult.ToString(); return(result); } }
public RemoveWizardStepCommand(CommonCmdletBase cmdlet) : base (cmdlet) { }
internal UIANewRemoteDesktopProtocolFileCommand(CommonCmdletBase cmdlet) : base(cmdlet) { }
public ExitWizardCommand(CommonCmdletBase cmdlet) : base(cmdlet) { }
public AddWizardStepCommand(CommonCmdletBase cmdlet) : base (cmdlet) { }
public StepWizardCommand(CommonCmdletBase cmdlet) : base(cmdlet) { }
// 20140211 // internal UiaCommand(CommonCmdletBase cmdlet) public UiaCommand(CommonCmdletBase cmdlet) { Cmdlet = cmdlet; }
protected internal void WriteDebug(CommonCmdletBase cmdlet, string text) { string reportString = CmdletSignature(cmdlet) + text; WriteLog(reportString); }
public ExitWizardCommand(CommonCmdletBase cmdlet) : base (cmdlet) { }
internal UIAInvokeWizardCommand(CommonCmdletBase cmdlet) : base(cmdlet) { }
public AddWizardStepCommand(CommonCmdletBase cmdlet) : base(cmdlet) { }
public NewRemoteDesktopProtocolFileCommand(CommonCmdletBase cmdlet) : base(cmdlet) { }
public NewWizardCommand(CommonCmdletBase cmdlet) : base(cmdlet) { }
internal UIANewWizardCommand(CommonCmdletBase cmdlet) : base(cmdlet) { }
private void checkConditionsArray( string controlType, string controlTypeProperty, string controlTypeValue) { Condition[] conditions = null; cmdlet = new UIAutomation.Commands.GetUIAControlCommand(); cmdletBase = // 20130221 // new UIAutomation.CommonCmdletBase(); new UIAutomation.GetControlCmdletBase(); AndCondition condition = // 20130127 //cmdlet.getControlConditions(cmdlet, controlType); // 20130128 //cmdlet.getControlConditions(cmdlet, controlType, ((GetControlCmdletBase)cmdlet).CaseSensitive); //cmdlet.getControlConditions(cmdlet, controlType, ((GetControlCmdletBase)cmdlet).CaseSensitive, true); cmdlet.getControlConditions(cmdlet, controlType, ((GetControlCmdletBase)cmdlet).CaseSensitive, true) as AndCondition; conditions = condition.GetConditions(); foreach (Condition cond in conditions) { if ((cond as PropertyCondition) != null) { Assert.AreEqual( controlTypeProperty, (cond as PropertyCondition).Property.ProgrammaticName); Assert.AreEqual( controlTypeValue, (cond as PropertyCondition).Value.ToString()); } else { Assert.AreEqual(cond, Condition.TrueCondition); } } }
public StepWizardCommand(CommonCmdletBase cmdlet) : base (cmdlet) { }
public RemoveWizardStepCommand(CommonCmdletBase cmdlet) : base(cmdlet) { }