public void Next_ReturnsStepTransitionResult()
        {
            _step1Mock.Setup(x => x.Next(It.IsAny <Node>())).Returns(StepTransitionResult.Failure("test"));

            Node node = new Node();
            StepTransitionResult result = _session.Next(node);

            result.Should().BeEquivalentTo(new
            {
                CanTransition = false,
                ErrorMessage  = "test"
            });
        }
        public void DefineNodeWizardStep_WithInvalidAddress_BlocksTransition()
        {
            DefineNodeWizardStep step = new DefineNodeWizardStep();
            Node node = new Node {
                IpOrHostname = ""
            };

            StepTransitionResult result = step.Next(node);

            result.Should().BeEquivalentTo(new StepTransitionResult
            {
                CanTransition = false,
                ErrorMessage  = "Node address has to be specified."
            });
        }
示例#3
0
        public async Task WalkThroughWizard_WithInvalidNode_DoesNodeAllowNextOnFirstStep()
        {
            Node node = new Node()
            {
                IpOrHostname = "", PollingMethod = "ICMP"
            };

            // first step
            HttpWebResponse response     = Post("/wizard/next", JsonConvert.SerializeObject(node));
            string          responseData = await GetResponseData(response);

            StepTransitionResult transitionResult = JsonConvert.DeserializeObject <StepTransitionResult>(responseData);

            transitionResult.Should().BeEquivalentTo(new StepTransitionResult
            {
                CanTransition = false,
                ErrorMessage  = "Node address has to be specified."
            });
        }
示例#4
0
        public async Task WalkThroughWizard_WithValidNode_DoesNotAllowNextOnLastStep()
        {
            Node node = new Node()
            {
                IpOrHostname = "1.2.3.4", PollingMethod = "ICMP"
            };

            // first step
            Post("/wizard/next", JsonConvert.SerializeObject(node));
            // second step - the last
            HttpWebResponse response = Post("/wizard/next", JsonConvert.SerializeObject(node));

            string responseData = await GetResponseData(response);

            StepTransitionResult transitionResult = JsonConvert.DeserializeObject <StepTransitionResult>(responseData);

            transitionResult.Should().BeEquivalentTo(new StepTransitionResult
            {
                CanTransition = false,
                ErrorMessage  = "This is the last step"
            });
        }