예제 #1
0
 private static void GenerateChildConditionMock(Or condition, bool passes)
 {
     var conditionMock = new Mock<TaskCondition>(MockBehavior.Strict);
     conditionMock.Setup(c => c.Evaluate(It.IsAny<TaskExecutionContext>()))
         .Returns(passes);
     condition.Children.Add(conditionMock.Object);
 }
예제 #2
0
 public void EvaluateReturnsTrueIfAChildPasses()
 {
     var condition = new Or();
     GenerateChildConditionMock(condition, true);
     GenerateChildConditionMock(condition, false);
     var contextMock = new Mock<TaskExecutionContext>(new TaskExecutionParameters());
     var result = condition.Evaluate(contextMock.Object);
     Assert.IsTrue(result);
 }
예제 #3
0
 public void ValidateValidatesChildren()
 {
     var condition = new Or();
     var conditionMock = new Mock<TaskCondition>(MockBehavior.Strict);
     conditionMock.Setup(c => c.Validate(It.IsAny<IValidationLog>())).Verifiable();
     condition.Children.Add(conditionMock.Object);
     condition.Validate(null);
     conditionMock.Verify();
 }