internal static T Get <T>(AppModel model, string conditionString) where T : UIAControlBase, new() { UIACondition condition = UIACondition.GetCondition(model, conditionString); T control = new T(); ((UIAControlBase)control).SetCondition(condition); return(control); }
public static UIACondition GetCondition(UIACondition parentCondition, ControlType controlType, params string[] conditionStrings) { UIATestObject testObject = GetTO(parentCondition.TestObject, controlType, conditionStrings); //UIACondition currentCondition = parentCondition.CheckUIAConditionExists(testObject, controlType); //TODO, handle more conditionStrings return(UIACondition.GetCondition(testObject)); //if (currentCondition != null) // return currentCondition; //return GetCondition(parentCondition, testObject, controlType); }
public void ControlSearcher_GetCondition() { AppModel.Initialize("UnitTestObjectModel1.json"); UIATestObject parentObject = (UIATestObject)AppModel.Current.GetTestObject("LAP (Running) - Microsoft Visual Studio"); //UIATestObject testObject = (UIATestObject)parentObject.FindRecursive(DescriptorKeys.NodeName, "Search"); Assert.IsNotNull(parentObject, "Should find the parent test object in the model"); UIACondition parentCondition = UIACondition.GetCondition(parentObject); UIACondition childCondition = ControlSearcher.GetCondition(parentCondition, ControlType.Edit, "Search"); Assert.IsNotNull(childCondition, "Should not be able to find the child condition"); }