static void TestBindingExtensionsInTarget(SearchTestControl ctrl, Button button1, TextBox textBox) { DependencyObject b = ctrl.LogicalTree().ByBinding("Button1Command").Single(); Assert.AreEqual(button1, b); var collection = ctrl.LogicalTree().ByBinding("DataText"); Assert.AreEqual(2, collection.Count()); var t = ctrl.LogicalTree().ByBinding("DataText", ctrl.DataContext).Single(); Assert.AreEqual(textBox, t); }
static void TestTypeExtensionsInTarget(SearchTestControl ctrl, ListView listView) { var collection = ctrl.LogicalTree().ByType(typeof(Button).FullName); Assert.AreEqual(2, collection.Count()); collection = ctrl.LogicalTree().ByType <Button>(); Assert.AreEqual(2, collection.Count()); collection = ctrl.LogicalTree().ByType <ButtonBase>(); Assert.AreEqual(3, collection.Count()); var list = ctrl.LogicalTree().ByType(typeof(ListView).FullName).Single(); Assert.AreEqual(list, listView); list = ctrl.LogicalTree().ByType <ListView>().Single(); Assert.AreEqual(list, listView); }
static void TestLogicalTreeInTargetExtensions(SearchTestControl ctrl, Button button1, ListView listView) { var b = ctrl.LogicalTree().ByBinding("Button1Command").Single(); Assert.AreEqual(button1, b); Assert.AreEqual(0, listView.LogicalTree().ByType <ListViewItem>().Count()); }
static string TestNameTextExtensionsInTarget(SearchTestControl ctrl) => ctrl.LogicalTree().ByType <FrameworkElement>().ByName("_listView").Single().Name;
static string TestTextExtensionsInTarget(SearchTestControl ctrl) => ctrl.LogicalTree().ByType <TextBlock>().ByText("AAA").Single().Name;
static string TestContentTextExtensionsInTarget(SearchTestControl ctrl) => ctrl.LogicalTree().ByType <ContentControl>().ByContentText("abc").Single().GetType().Name;
static void TestLogicalTreeInTargetExtensions(SearchTestControl ctrl, Button button1, ListView listView) { var b = ctrl.LogicalTree().ByBinding("Button1Command").Single(); Assert.AreEqual(button1, b); Assert.AreEqual(0, listView.LogicalTree().ByType<ListViewItem>().Count()); }
static void TestTypeExtensionsInTarget(SearchTestControl ctrl, ListView listView) { var collection = ctrl.LogicalTree().ByType(typeof(Button).FullName); Assert.AreEqual(2, collection.Count()); collection = ctrl.LogicalTree().ByType<Button>(); Assert.AreEqual(2, collection.Count()); collection = ctrl.LogicalTree().ByType<ButtonBase>(); Assert.AreEqual(2, collection.Count()); var list = ctrl.LogicalTree().ByType(typeof(ListView).FullName).Single(); Assert.AreEqual(list, listView); list = ctrl.LogicalTree().ByType <ListView>().Single(); Assert.AreEqual(list, listView); }