Example #1
0
        public void TestLogicalTree()
        {
            AppVar button1 = Searcher.ByBinding(TreeUtility.LogicalTree(_ctrl), "Button1Command").Single();

            Assert.AreEqual(button1, _ctrl._button1);
            Assert.AreEqual(0, TreeUtility.LogicalTree((AppVar)_ctrl._listView).ByType <ListViewItem>().Count);
        }
        public void TestByIsCancel()
        {
            var    buttons = TreeUtility.LogicalTree((AppVar)_ctrl).ByType <Button>();
            AppVar button5 = ButtonSearcher.ByIsCancel(buttons).Single();

            Assert.AreEqual(button5, _ctrl._button5);
        }
        public void TestByCommandParameterText()
        {
            var    buttons = TreeUtility.LogicalTree((AppVar)_ctrl).ByType <Button>();
            AppVar button4 = ButtonSearcher.ByCommandParameterText(buttons, "A").Single();

            Assert.AreEqual(button4, _ctrl._button4);
        }
        public void TestByCommand()
        {
            var    buttons = TreeUtility.LogicalTree((AppVar)_ctrl).ByType <Button>();
            AppVar button2 = ButtonSearcher.ByCommand(buttons, ApplicationCommands.Close).Single();

            Assert.AreEqual(button2, _ctrl._button2);
            button2 = ButtonSearcher.ByCommand(buttons, typeof(ApplicationCommands).FullName, "Close").Single();
            Assert.AreEqual(button2, _ctrl._button2);
        }
        public void TestByCommandParameterEnum()
        {
            var    buttons = TreeUtility.LogicalTree((AppVar)_ctrl).ByType <Button>();
            AppVar button4 = ButtonSearcher.ByCommandParameter(buttons, CommandPrameterType.A).Single();

            Assert.AreEqual(button4, _ctrl._button4);
            button4 = ButtonSearcher.ByCommandParameter(buttons, new ExplicitAppVar(_app.Copy(CommandPrameterType.A))).Single();
            Assert.AreEqual(button4, _ctrl._button4);
        }
        public void TestByCommandParameter()
        {
            var    buttons = TreeUtility.LogicalTree((AppVar)_ctrl).ByType <Button>();
            AppVar button1 = ButtonSearcher.ByCommandParameter(buttons, "button1").Single();

            Assert.AreEqual(button1, _ctrl._button1);
            button1 = ButtonSearcher.ByCommandParameter(buttons, new ExplicitAppVar(_app.Copy("button1"))).Single();
            Assert.AreEqual(button1, _ctrl._button1);
        }
Example #7
0
        public void TestBinding()
        {
            AppVar button1 = Searcher.ByBinding(TreeUtility.LogicalTree(_ctrl), "Button1Command").Single();

            Assert.IsTrue(button1.Equals(_ctrl._button1));

            var collection = Searcher.ByBinding(TreeUtility.LogicalTree(_ctrl), "DataText");

            Assert.AreEqual(2, collection.Count);

            var textBox = Searcher.ByBinding(TreeUtility.LogicalTree(_ctrl), "DataText", new ExplicitAppVar(_ctrl.DataContext)).Single();

            Assert.IsTrue(textBox.Equals(_ctrl._textBox));
        }
Example #8
0
        public void TestType()
        {
            AppVar target     = _ctrl;
            var    collection = Searcher.ByType(TreeUtility.LogicalTree(target), typeof(Button).FullName);

            Assert.AreEqual(2, collection.Count);
            collection = Searcher.ByType <Button>(TreeUtility.LogicalTree(target));
            Assert.AreEqual(2, collection.Count);
            collection = Searcher.ByType <ButtonBase>(TreeUtility.LogicalTree(target));
            Assert.AreEqual(3, collection.Count);

            var list = Searcher.ByType(TreeUtility.LogicalTree(target), typeof(ListView).FullName).Single();

            Assert.AreEqual(list, _ctrl._listView);
            list = Searcher.ByType <ListView>(TreeUtility.LogicalTree(target)).Single();
            Assert.AreEqual(list, _ctrl._listView);
        }