Exemple #1
0
        public void SelectButtonOnKey()
        {
            tlog.Debug(tag, $"SelectButtonOnKey START");

            var testingTarget = new MySelectButton()
            {
                IsEnabled = true,
            };

            Assert.IsNotNull(testingTarget, "null handle");
            Assert.IsInstanceOf <SelectButton>(testingTarget, "Should return SelectButton instance.");

            Key key    = null;
            var result = testingTarget.OnKey(key);

            tlog.Debug(tag, "OnKey : " + result);

            try
            {
                key = new Key()
                {
                    State = Key.StateType.Down,
                };
                testingTarget.OnKey(key);
            }
            catch (Exception e)
            {
                tlog.Debug(tag, e.Message.ToString());
                Assert.Fail("Caught Exception : Failed!");
            }

            testingTarget.Dispose();
            tlog.Debug(tag, $"SelectButtonOnKey END (OK)");
        }
Exemple #2
0
        public void SelectButtonOnControlStateChanged()
        {
            tlog.Debug(tag, $"SelectButtonOnControlStateChanged START");

            var testingTarget = new MySelectButton()
            {
                IsEnabled = true,
            };

            Assert.IsNotNull(testingTarget, "null handle");
            Assert.IsInstanceOf <SelectButton>(testingTarget, "Should return SelectButton instance.");

            Key key = new Key()
            {
                State          = Key.StateType.Up,
                KeyPressedName = "Return"
            };

            testingTarget.OnKey(key);

            testingTarget.SelectedChanged += OnSelectedChanged;

            try
            {
                ControlStateChangedEventArgs args = new ControlStateChangedEventArgs(ControlState.Selected, ControlState.Normal);
                testingTarget.MyOnControlStateChanged(args);
            }
            catch (Exception e)
            {
                tlog.Debug(tag, e.Message.ToString());
                Assert.Fail("Caught Exception : Failed!");
            }

            testingTarget.SelectedChanged -= OnSelectedChanged;

            testingTarget.Dispose();
            tlog.Debug(tag, $"SelectButtonOnControlStateChanged END (OK)");
        }