public void MyTestInitialize()
{
// Create the factory and register schemas
_factory = new CUIAutomationClass();
ReadyStateSchema.GetInstance().Register();
TestSchema.GetInstance().Register();
ColorSchema.GetInstance().Register();
// Start the app
var curDir = Environment.CurrentDirectory;
_app = new TargetApp(curDir + "\\UiaControls.exe");
_app.Start();
// Find the main control
var appElement = _factory.ElementFromHandle(_app.MainWindow);
var condition = _factory.CreatePropertyCondition(
UIA_PropertyIds.UIA_AutomationIdPropertyId,
"triColorControl1");
_customElement = appElement.FindFirst(TreeScope.TreeScope_Children,
condition);
Assert.IsNotNull(_customElement);
}