GetConditions() public method

public GetConditions ( ) : Condition[]
return Condition[]
示例#1
0
        public void ContentViewConditionTest()
        {
            SWA.Condition contentViewCond = SWA.Automation.ContentViewCondition;
            Assert.IsNotNull(contentViewCond, "ContentViewCondition");

            SWA.PropertyCondition contentViewPropCond = contentViewCond as SWA.PropertyCondition;
            Assert.IsNull(contentViewPropCond, "ContentViewCondition is not a PropertyCondition");

            SWA.AndCondition contentViewAndCond = contentViewCond as SWA.AndCondition; Assert.IsNull(contentViewPropCond, "ContentViewCondition is not a PropertyCondition");
            Assert.IsNull(contentViewAndCond, "ContentViewCondition is not a AndCondition");

            SWA.OrCondition contentViewOrCond = contentViewCond as SWA.OrCondition;
            Assert.IsNull(contentViewOrCond, "ContentViewCondition is not a OrCondition");

            SWA.NotCondition contentViewNotCond = contentViewCond as SWA.NotCondition;
            Assert.IsNotNull(contentViewNotCond, "ContentViewCondition is a NotCondition");

            SWA.Condition subCond = contentViewNotCond.Condition;
            Assert.IsNotNull(subCond, "ContentViewCondition.Condition");

            SWA.OrCondition subOrCond = subCond as SWA.OrCondition;
            Assert.IsNotNull(subOrCond, "ContentViewCondition.Condition is a OrCondition");

            SWA.Condition [] subSubConditions = subOrCond.GetConditions();
            Assert.AreEqual(2, subSubConditions.Length, "ContentViewCondition.Condition.GetConditions length");

            SWA.PropertyCondition subSubPropertyCond1 = subSubConditions [0] as SWA.PropertyCondition;
            Assert.IsNotNull(subSubPropertyCond1);
            SWA.PropertyCondition subSubPropertyCond2 = subSubConditions [1] as SWA.PropertyCondition;
            Assert.IsNotNull(subSubPropertyCond2);

            Assert.AreEqual(AEIds.IsControlElementProperty,
                            subSubPropertyCond1.Property,
                            "subcondition1 Property");
            Assert.AreEqual(false,
                            subSubPropertyCond1.Value,
                            "subcondition1 Value");
            Assert.AreEqual(SWA.PropertyConditionFlags.None,
                            subSubPropertyCond1.Flags,
                            "subcondition1 Flags");

            Assert.AreEqual(AEIds.IsContentElementProperty.ProgrammaticName,
                            subSubPropertyCond2.Property.ProgrammaticName,
                            "subcondition2 Property");
            Assert.AreEqual(false,
                            subSubPropertyCond2.Value,
                            "subcondition2 Value");
            Assert.AreEqual(SWA.PropertyConditionFlags.None,
                            subSubPropertyCond2.Flags,
                            "subcondition2 Flags");
        }
示例#2
0
        public void OrConditionTest()
        {
            Condition condition = Condition.TrueCondition;
            Condition condition2 = OrCondition.FalseCondition;
            OrCondition target = new OrCondition(condition, condition2);
            Condition[] actual;
            actual = target.GetConditions();
            Assert.IsNotNull(actual);
            Assert.AreEqual(actual.Length, 2);

            // Negative test - include a null
            try
            {
                target = new OrCondition(condition, null);

                Assert.Fail("expected exception");
            }
            catch (System.ArgumentException)
            {
            }
        }