Exemple #1
0
        public void NumberBoxDisplayChangingPageTest()
        {
            using (var setup = new TestSetupHelper("PagerControl Tests"))
            {
                elements = new PagerControlTestPageElements();

                SetNumberBoxDisplayMode();
                VerifyNumberBoxDisplayMode();
                VerifyPageChanged(0);

                SendValueToNumberBox("3"); // Note: PagerControl displays numbers starting at 1 but the page changed event sends 0-based numbers
                VerifyPageChanged(2);

                SendValueToNumberBox("1");
                VerifyPageChanged(0);

                SendValueToNumberBox("5");
                VerifyPageChanged(4);

                SendValueToNumberBox("2");
                VerifyPageChanged(1);

                SendValueToNumberBox("100");
                Verify.AreEqual("5", FindTextBox(elements.GetPagerNumberBox()).GetText()); // If over max, value should be clamped down to the max.
                VerifyPageChanged(4);

                SendValueToNumberBox("-100");
                Verify.AreEqual("1", FindTextBox(elements.GetPagerNumberBox()).GetText()); // If under min, value should be clamped up to the min.
                VerifyPageChanged(0);
            }
        }
        protected void SendValueToNumberBox(string value)
        {
            Edit textbox = FindTextBox(elements.GetPagerNumberBox());

            Verify.IsNotNull(textbox);

            KeyboardHelper.EnterText(textbox, value);
            KeyboardHelper.PressKey(Key.Enter);
            Wait.ForIdle();
        }
Exemple #3
0
        public void NumberBoxInfinityModeTest()
        {
            using (var setup = new TestSetupHelper("PagerControl Tests"))
            {
                elements = new PagerControlTestPageElements();

                SetNumberBoxDisplayMode();
                VerifyNumberBoxDisplayMode();
                VerifyPageChanged(0);
                elements.GetEnterInfinityModeButton().Click();

                SendValueToNumberBox("3"); // Note: PagerControl displays numbers starting at 1 but the page changed event sends 0-based numbers
                VerifyPageChanged(2);

                SendValueToNumberBox("1");
                VerifyPageChanged(0);

                SendValueToNumberBox("5");
                VerifyPageChanged(4);

                SendValueToNumberBox("2");
                VerifyPageChanged(1);

                SendValueToNumberBox("100");
                Verify.AreEqual("100", FindTextBox(elements.GetPagerNumberBox()).GetText());
                VerifyPageChanged(99);

                SendValueToNumberBox("10000");
                Verify.AreEqual("10000", FindTextBox(elements.GetPagerNumberBox()).GetText());
                VerifyPageChanged(9999);

                SendValueToNumberBox("-100");
                Verify.AreEqual("1", FindTextBox(elements.GetPagerNumberBox()).GetText());
                VerifyPageChanged(0);
            }
        }