示例#1
0
        public async void GetNodesActionSuccess()
        {
            var controller = new NodesController(fixture.Context);
            var result     = await controller.GetNodes(1);

            Assert.IsType <OkObjectResult>(result);
        }
示例#2
0
        public void GetNodesNotNull()
        {
            var controller = new NodesController(fixture.Context);
            var result     = controller.GetNodes();

            Assert.NotNull(result);
        }
示例#3
0
        public void GetNodes_ReturnsNodesServiceResult()
        {
            _nodeServiceMock.Setup(x => x.GetNodes())
            .Returns(new[]
            {
                new Node {
                    Id = 1, IpOrHostname = "1.1.1.1", PollingMethod = "WMI"
                },
                new Node {
                    Id = 2, IpOrHostname = "2.2.2.2", PollingMethod = "SNMP"
                }
            });

            var actionResult = _controller.GetNodes();

            actionResult.Should().BeOfType <OkObjectResult>()
            .Which.Value.Should().BeAssignableTo <IEnumerable <Node> >()
            .Which.Should().BeEquivalentTo(new[]
            {
                new { IpOrHostname = "1.1.1.1" },
                new { IpOrHostname = "2.2.2.2" }
            },
                                           options => options.ExcludingMissingMembers().WithStrictOrdering());
        }