コード例 #1
0
        public void RemoveReadOnlyAction()
        {
            ExpressionCondition parentCondition = new ExpressionCondition() { Expression = "test > 1" };
            ReadOnlyExpressionCondition childCondition = new ReadOnlyExpressionCondition(parentCondition);

            Action parentAction = new Action(Workspace.Instance.GetPlugin(FireTriggerActionType));
            parentCondition.AddStatement(parentAction);
            parentCondition.RemoveStatement(parentAction);

            Assert.AreEqual(0, childCondition.Statements.Count);
        }
コード例 #2
0
        public void RemoveAction()
        {
            int eventsFired = 0;

            ExpressionCondition condition = new ExpressionCondition() { Expression = "test > 1" };
            condition.Statements.CollectionChanged += (o, e) => eventsFired++;

            Action action = new Action(Workspace.Instance.GetPlugin(FireTriggerActionType));
            condition.AddStatement(action);
            condition.RemoveStatement(action);

            Assert.AreEqual(2, eventsFired);
            Assert.AreEqual(0, condition.Statements.Count);
        }