예제 #1
0
 public void CanExecuteReturnsTrueWithNoConditions()
 {
     var contextMock = GenerateContextMock();
     var task = new TaskStub();
     var expected = task.CanRun(contextMock.Object);
     Assert.IsTrue(expected);
 }
예제 #2
0
 public void CanExecuteReturnsFalseWhenAnyConditionIsFalse()
 {
     var contextMock = GenerateContextMock();
     var condition1Mock = new Mock<TaskCondition>();
     var condition2Mock = new Mock<TaskCondition>();
     condition1Mock.Setup(c => c.Evaluate(contextMock.Object)).Returns(true);
     condition2Mock.Setup(c => c.Evaluate(contextMock.Object)).Returns(false);
     var task = new TaskStub();
     task.Conditions.Add(condition1Mock.Object);
     task.Conditions.Add(condition2Mock.Object);
     var expected = task.CanRun(contextMock.Object);
     Assert.IsFalse(expected);
 }