/// <summary> /// Performs a single step /// </summary> public void StepOnce() { SubStep subStep = null; if (ActiveBlockingExpectations().Count == 0) { // When no blocking expectation, one can execute the next substep subStep = CurrentSubStep(); if (EventTimeLine.ContainsSubStep(subStep)) { NextSubStep(); subStep = CurrentSubStep(); } SetupSubStep(subStep); } if (subStep == null) { Cycle(); } else if (!subStep.getSkipEngine()) { Cycle(); } else { CheckExpectationsState(acceptor.RulePriority.aCleanUp); NextCycle(); } }
/// <summary> /// Synchronizes the set of completed substep according to the time line /// </summary> private void SynchronizeCompletedSubStepWithTimeLine() { List <SubStep> toRemove = new List <SubStep>(); foreach (SubStep subStep in CompletedSubStep) { if (!EventTimeLine.ContainsSubStep(subStep)) { toRemove.Add(subStep); } } foreach (SubStep subStep in toRemove) { CompletedSubStep.Remove(subStep); } }
/// <summary> /// Setups the sub-step by applying its actions and adding its expects in the expect list /// </summary> /// <returns>True if the substep was not already seetup</returns> public bool SetupSubStep(SubStep subStep) { bool retVal = false; if (subStep != null) { if (!EventTimeLine.ContainsSubStep(subStep)) { Util.DontNotify(() => { LogInstance = subStep; CacheImpact = new CacheImpact(); EventTimeLine.AddModelEvent(new SubStepActivated(subStep, CurrentPriority), true); ClearCaches(); }); retVal = true; } } return(retVal); }