コード例 #1
0
        public IActionResult Back()
        {
            if (!CanGoBack)
            {
                return(Ok(StepTransitionResult.Failure("This is the first step")));
            }

            _currentIndex--;
            return(Ok(StepTransitionResult.Success()));
        }
コード例 #2
0
        public StepTransitionResult Next(Node node)
        {
            // validates data, may do something more and returns transition result
            if (string.IsNullOrEmpty(node.IpOrHostname))
            {
                return(StepTransitionResult.Failure("Node address has to be specified."));
            }

            node.IpOrHostname = NormalizeIpOrHostname(node.IpOrHostname);

            return(StepTransitionResult.Success());
        }
コード例 #3
0
        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();
        }
コード例 #4
0
 public StepTransitionResult Next(Node node)
 {
     return(StepTransitionResult.Success());
 }