コード例 #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);
        }
コード例 #2
0
        public void TestByIsCancel()
        {
            var    buttons = TreeUtility.LogicalTree((AppVar)_ctrl).ByType <Button>();
            AppVar button5 = ButtonSearcher.ByIsCancel(buttons).Single();

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

            Assert.AreEqual(button4, _ctrl._button4);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        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);
        }
コード例 #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));
        }
コード例 #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);
        }