Esempio n. 1
0
 public void NextTimeReturnsLowestValidTime()
 {
     var child1 = new TriggerStub();
     var child2 = new TriggerStub { NextTimeValue = DateTime.Now };
     var child3 = new TriggerStub { NextTimeValue = DateTime.Now.AddHours(1) };
     var trigger = new Multiple(child1, child2, child3);
     var actual = trigger.NextTime;
     Assert.AreEqual(child2.NextTimeValue, actual);
 }
Esempio n. 2
0
 public void ResetResetsChildren()
 {
     var reset = false;
     var child = new TriggerStub
                     {
                         OnResetAction = () => reset = true
                     };
     var trigger = new Multiple(child);
     trigger.Reset();
     Assert.IsTrue(reset);
 }
Esempio n. 3
0
 public void CleanUpCleansChildren()
 {
     var cleaned = false;
     var child = new TriggerStub
                     {
                         OnCleanUp = () => cleaned = true
                     };
     var trigger = new Multiple(child);
     trigger.CleanUp();
     Assert.IsTrue(cleaned);
 }
Esempio n. 4
0
 public void InitialiseInitialisesChildren()
 {
     var initialised = false;
     var child = new TriggerStub
     {
         OnInitialise = () => initialised = true
     };
     var trigger = new Multiple(child);
     trigger.Initialise();
     Assert.IsTrue(initialised);
 }
Esempio n. 5
0
 public void ValidateValidatesChildren()
 {
     var validated = false;
     var child = new TriggerStub
                     {
                         OnValidate = vl => validated = true
                     };
     var trigger = new Multiple(child);
     var validationMock = new Mock<IValidationLog>();
     trigger.Validate(validationMock.Object);
     Assert.IsTrue(validated);
 }
Esempio n. 6
0
 public void CheckReturnsRequestIfAnyChildSetWithOr()
 {
     var child1 = new TriggerStub { OnCheckAction = () => null };
     var child2 = new TriggerStub { OnCheckAction = () => new IntegrationRequest("Dummy") };
     var trigger = new Multiple(child1, child2);
     var actual = trigger.Check();
     Assert.IsNotNull(actual);
     Assert.AreEqual("Multiple", actual.SourceTrigger);
 }
Esempio n. 7
0
 public void CheckReturnsNullIfAllChildrenNullWithOr()
 {
     var child1 = new TriggerStub { OnCheckAction = () => null };
     var child2 = new TriggerStub { OnCheckAction = () => null };
     var trigger = new Multiple(child1, child2);
     var actual = trigger.Check();
     Assert.IsNull(actual);
 }
Esempio n. 8
0
 public void CheckReturnsRequestIfAllChildrenSetWithAnd()
 {
     var child1 = new TriggerStub { OnCheckAction = () => new IntegrationRequest("Dummy") };
     var child2 = new TriggerStub { OnCheckAction = () => new IntegrationRequest("Dummy") };
     var trigger = new Multiple(child1, child2)
                       {
                           Condition = CombinationOperator.And
                       };
     var actual = trigger.Check();
     Assert.IsNotNull(actual);
     Assert.AreEqual("Multiple", actual.SourceTrigger);
 }
Esempio n. 9
0
 public void CheckReturnsNullIfAnyChildNullWithAnd()
 {
     var child1 = new TriggerStub { OnCheckAction = () => null };
     var child2 = new TriggerStub { OnCheckAction = () => new IntegrationRequest("Dummy") };
     var trigger = new Multiple(child1, child2)
                       {
                           Condition = CombinationOperator.And
                       };
     var actual = trigger.Check();
     Assert.IsNull(actual);
 }