public void Cancel_ResetsToFirstStep() { Node node = new Node(); _session.Next(node); _session.Next(node); _session.Cancel(); _session.CurrentStep.Should().BeSameAs(_step1Mock.Object, "Cancel should go to first step."); }
public WizardSessionTest() { _step1Mock = new Mock <IWizardStep>(); _step1Mock.Setup(x => x.Next(It.IsAny <Node>())).Returns(StepTransitionResult.Success()); _step2Mock = new Mock <IWizardStep>(); _step2Mock.Setup(x => x.Next(It.IsAny <Node>())).Returns(StepTransitionResult.Success()); var step3Mock = new Mock <IWizardStep>(); step3Mock.Setup(x => x.Next(It.IsAny <Node>())).Returns(StepTransitionResult.Success()); _stepsProviderMock = new Mock <IWizardStepsProvider>(); _stepsProviderMock.Setup(x => x.GetWizardSteps()) .Returns(new[] { _step1Mock.Object, _step2Mock.Object, step3Mock.Object }); _session = new WizardSession(_stepsProviderMock.Object); // Session is using static fields to keep state for purpose of this example so we need to clear it. // Production code would use different way of keeping the state like real Session, special token etc. _session.Cancel(); }