static void TestVisualTreeInTargetExtensions(SearchTestControl ctrl, Button button1, ListView listView) { var b = ctrl.VisualTree().ByBinding("Button1Command").Single(); Assert.AreEqual(button1, b); Assert.AreEqual(3, listView.VisualTree().ByType <ListViewItem>().Count()); }
static SearchTestControl Init(Grid grid) { SearchTestControl ctrl = new SearchTestControl(); grid.Children.Add(ctrl); return(ctrl); }
static void TestLogicalTreeInTarget(SearchTestControl ctrl, Button button1, ListView listView) { var b = SearcherInTarget.ByBinding(TreeUtilityInTarget.LogicalTree(ctrl), "Button1Command").Single(); Assert.AreEqual(button1, b); Assert.AreEqual(0, TreeUtilityInTarget.LogicalTree(listView).ByType <ListViewItem>().Count()); }
static void TestBindingInTarget(SearchTestControl ctrl, Button button1, TextBox textBox) { DependencyObject b = SearcherInTarget.ByBinding(TreeUtilityInTarget.LogicalTree(ctrl), "Button1Command").Single(); Assert.AreEqual(button1, b); var collection = SearcherInTarget.ByBinding(TreeUtilityInTarget.LogicalTree(ctrl), "DataText"); Assert.AreEqual(2, collection.Count()); var t = SearcherInTarget.ByBinding(TreeUtilityInTarget.LogicalTree(ctrl), "DataText", ctrl.DataContext).Single(); Assert.AreEqual(textBox, t); }
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 TestTypeInTarget(SearchTestControl ctrl, ListView listView) { var collection = SearcherInTarget.ByType(TreeUtilityInTarget.LogicalTree(ctrl), typeof(Button).FullName); Assert.AreEqual(2, collection.Count()); collection = SearcherInTarget.ByType <Button>(TreeUtilityInTarget.LogicalTree(ctrl)); Assert.AreEqual(2, collection.Count()); collection = SearcherInTarget.ByType <ButtonBase>(TreeUtilityInTarget.LogicalTree(ctrl)); Assert.AreEqual(3, collection.Count()); var list = SearcherInTarget.ByType(TreeUtilityInTarget.LogicalTree(ctrl), typeof(ListView).FullName).Single(); Assert.AreEqual(list, listView); list = SearcherInTarget.ByType <ListView>(TreeUtilityInTarget.LogicalTree(ctrl)).Single(); Assert.AreEqual(list, listView); }
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 TestTypeInTarget(SearchTestControl ctrl, ListView listView) { var collection = SearcherInTarget.ByType(TreeUtilityInTarget.LogicalTree(ctrl), typeof(Button).FullName); Assert.AreEqual(2, collection.Count()); collection = SearcherInTarget.ByType<Button>(TreeUtilityInTarget.LogicalTree(ctrl)); Assert.AreEqual(2, collection.Count()); collection = SearcherInTarget.ByType<ButtonBase>(TreeUtilityInTarget.LogicalTree(ctrl)); Assert.AreEqual(2, collection.Count()); var list = SearcherInTarget.ByType(TreeUtilityInTarget.LogicalTree(ctrl), typeof(ListView).FullName).Single(); Assert.AreEqual(list, listView); list = SearcherInTarget.ByType<ListView>(TreeUtilityInTarget.LogicalTree(ctrl)).Single(); Assert.AreEqual(list, listView); }
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); }
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 TestLogicalTreeInTarget(SearchTestControl ctrl, Button button1, ListView listView) { var b = SearcherInTarget.ByBinding(TreeUtilityInTarget.LogicalTree(ctrl), "Button1Command").Single(); Assert.AreEqual(button1, b); Assert.AreEqual(0, TreeUtilityInTarget.LogicalTree(listView).ByType<ListViewItem>().Count()); }
static SearchTestControl Init(Grid grid) { SearchTestControl ctrl = new SearchTestControl(); grid.Children.Add(ctrl); return ctrl; }