示例#1
0
        public void ControlStateSubtractionWithTrueIsCombined()
        {
            tlog.Debug(tag, $"ControlStateSubtractionWithTrueIsCombined START");

            ControlState[] states1 = new ControlState[2];
            states1[0] = ControlState.Selected;
            states1[1] = ControlState.Focused;
            var testingTarget1 = ControlState.Create(states1);

            ControlState[] states2 = new ControlState[2];
            states2[0] = ControlState.Pressed;
            states2[1] = ControlState.Focused;
            var testingTarget2 = ControlState.Create(states2);

            var result = testingTarget1 - testingTarget2;

            Assert.AreEqual("Selected", result.ToString(), "Should be equal!");

            ControlState[] states3 = new ControlState[2];
            states3[0] = ControlState.Selected;
            states3[1] = ControlState.Focused;
            var testingTarget3 = ControlState.Create(states3);

            ControlState[] states4 = new ControlState[2];
            states4[0] = ControlState.Pressed;
            states4[1] = ControlState.Disabled;
            var testingTarget4 = ControlState.Create(states4);

            result = testingTarget3 - testingTarget4;
            Assert.AreEqual("Selected, Focused", result.ToString(), "Should be equal!");

            tlog.Debug(tag, $"ControlStateSubtractionWithTrueIsCombined END (OK)");
        }
示例#2
0
        public void ControlStateCreateWithAddedState()
        {
            tlog.Debug(tag, $"ControlStateCreateWithAddedState START");

            var testingTarget = ControlState.Create("Focused");

            Assert.IsNotNull(testingTarget);
            Assert.AreEqual(ControlState.Focused, testingTarget, "Should be equal!");

            tlog.Debug(tag, $"ControlStateCreateWithAddedState END (OK)");
        }
示例#3
0
        public void ControlStateContainsWithFalseIsCombined()
        {
            tlog.Debug(tag, $"ControlStateContainsWithFalseIsCombined START");

            ControlState[] states = new ControlState[1];
            states[0] = ControlState.Normal;
            var testingTarget = ControlState.Create(states);

            Assert.AreEqual(true, testingTarget.Contains(ControlState.Normal), "Should be equal!");

            tlog.Debug(tag, $"ControlStateContainsWithFalseIsCombined END (OK)");
        }
示例#4
0
        public void ControlStateCreateStateListLengthEqualZero()
        {
            tlog.Debug(tag, $"ControlStateCreateStateListLengthEqualZero START");

            ControlState[] states        = new ControlState[0];
            var            testingTarget = ControlState.Create(states);

            Assert.IsNotNull(testingTarget);
            Assert.AreEqual("Normal", testingTarget.ToString(), "Should be equal!");

            tlog.Debug(tag, $"ControlStateCreateStateListLengthEqualZero END (OK)");
        }
示例#5
0
        public void ControlStateCreateStateListLengthEqualOne()
        {
            tlog.Debug(tag, $"ControlStateCreateStateListLengthEqualOne START");

            ControlState[] states = new ControlState[1];
            states[0] = ControlState.Other;
            var testingTarget = ControlState.Create(states);

            Assert.IsNotNull(testingTarget);
            Assert.AreEqual("Other", testingTarget.ToString(), "Should be equal!");

            tlog.Debug(tag, $"ControlStateCreateStateListLengthEqualOne END (OK)");
        }
示例#6
0
        public void ControlStateCreateWithEmptyString()
        {
            tlog.Debug(tag, $"ControlStateCreateWithEmptyString START");

            try
            {
                string str = " ";
                ControlState.Create(str);
            }
            catch (ArgumentException e)
            {
                tlog.Debug(tag, e.Message.ToString());
                tlog.Debug(tag, $"ControlStateCreateWithEmptyString END (OK)");
                Assert.Pass("Caught ArgumentException: Passed!");
            }
        }
示例#7
0
        public void ControlStateContainsWithNullState()
        {
            tlog.Debug(tag, $"ControlStateContainsWithNullState START");

            ControlState state = ControlState.Create("Focused");

            try
            {
                state.Contains(null);
            }
            catch (ArgumentNullException e)
            {
                tlog.Debug(tag, e.Message.ToString());
                tlog.Debug(tag, $"ControlStateContainsWithNullState END (OK)");
                Assert.Pass("Caught ArgumentNullException: Passed!");
            }
        }
示例#8
0
        public void ControlStateContains()
        {
            tlog.Debug(tag, $"ControlStateContains START");

            ControlState[] states = new ControlState[5];
            states[0] = ControlState.Normal;
            states[1] = ControlState.Selected;
            states[2] = ControlState.Focused;
            states[3] = ControlState.Pressed;
            states[4] = ControlState.Disabled;
            var testingTarget = ControlState.Create(states);

            Assert.AreEqual(false, testingTarget.Contains(ControlState.All), "Should be equal!");
            Assert.AreEqual(true, testingTarget.Contains(ControlState.Selected), "Should be equal!");

            tlog.Debug(tag, $"ControlStateContains END (OK)");
        }
示例#9
0
        public void ControlStateCreateStateListContainAll()
        {
            tlog.Debug(tag, $"ControlStateCreateStateListContainAll START");

            ControlState[] states = new ControlState[5];
            states[0] = ControlState.Normal;
            states[1] = ControlState.Selected;
            states[2] = ControlState.All;
            states[3] = ControlState.Pressed;
            states[4] = ControlState.Disabled;
            var testingTarget = ControlState.Create(states);

            Assert.IsNotNull(testingTarget);
            Assert.AreEqual("All", testingTarget.ToString(), "Should be equal!");

            tlog.Debug(tag, $"ControlStateCreateStateListContainAll END (OK)");
        }
示例#10
0
        public void ControlStateCreateStateListLengthGreaterThanOne()
        {
            tlog.Debug(tag, $"ControlStateCreateStateListLengthGreaterThanOne START");

            ControlState[] states = new ControlState[5];
            states[0] = ControlState.Normal;
            states[1] = ControlState.Selected;
            states[2] = ControlState.Focused;
            states[3] = ControlState.Pressed;
            states[4] = ControlState.Disabled;
            var testingTarget = ControlState.Create(states);

            Assert.IsNotNull(testingTarget);
            Assert.AreEqual("Selected, Focused, Pressed, Disabled", testingTarget.ToString(), "Should be equal!");

            tlog.Debug(tag, $"ControlStateCreateStateListLengthGreaterThanOne END (OK)");
        }