Ejemplo n.º 1
0
        public void EvaluateReturnsFalseIfAllChildrenAreFalse()
        {
            Func <IIntegrationResult, bool> evalFunc = ir => false;
            var condition = new OrTaskCondition
            {
                Conditions = new[]
                {
                    new MockCondition {
                        EvalFunction = evalFunc
                    },
                    new MockCondition {
                        EvalFunction = evalFunc
                    }
                }
            };
            var result = this.mocks.Create <IIntegrationResult>(MockBehavior.Strict).Object;

            var actual = condition.Eval(result);

            this.mocks.VerifyAll();
            Assert.IsFalse(actual);
        }
Ejemplo n.º 2
0
        public void EvaluateReturnsTrueIfOneChildIsTrue()
        {
            var count = 0;
            Func <IIntegrationResult, bool> evalFunc = ir => (count++) % 2 == 0;
            var condition = new OrTaskCondition
            {
                Conditions = new[]
                {
                    new MockCondition {
                        EvalFunction = evalFunc
                    },
                    new MockCondition {
                        EvalFunction = evalFunc
                    }
                }
            };
            var result = this.mocks.Create <IIntegrationResult>(MockBehavior.Strict).Object;

            var actual = condition.Eval(result);

            this.mocks.VerifyAll();
            Assert.IsTrue(actual);
        }