public void RunAndVerifyExecutingStep(ConfigurableProgressEvents progressEvents, IProgressStep currentStep, int?currentVmIndex)
{
ProgressStepViewModel currentVM = currentVmIndex.HasValue ? this.visualizer.ViewModel.Steps[currentVmIndex.Value] : null;
bool isFinalState = ProgressControllerHelper.IsFinalState(currentStep.ExecutionState) && this.IsLastStep(currentStep);
// Trigger the event
progressEvents.InvokeStepExecutionChanged(new StepExecutionChangedEventArgs(currentStep));
// Assert
if (currentVmIndex.HasValue)
{
VerifyProgress(this.visualizer, this.ExpectedMainProgress, currentVM, this.ExpectedSubProgress);
if (isFinalState)
{
this.testSubject.CurrentExecutingGroup.Should().BeNull("Not expecting any executing group");
}
else
{
IProgressStep[] steps = this.GetAllStepsInGroup(currentStep);
if (currentStep.ImpactsProgress)
{
steps.Should().NotBeNull("There should be at least one step in the group");
VerifyExecutionGroup(this.testSubject.CurrentExecutingGroup, steps);
}
else
{
steps.Should().BeNull("Not expecting any steps in group since not impacting, so there's no group for it");
}
}
}
else
{
currentVM.Should().BeNull("Current VM should be null, since not impacts progress");
(this.testSubject.CurrentExecutingGroup == null ||
this.testSubject.CurrentExecutingGroup.ExecutingStep == null)
.Should().BeTrue("Not expecting any changes for non impacting steps");
}
}