コード例 #1
0
        public void Tree_PrettyPrint_TwoChildren_OneHasTwoChildren_WithOneGrandChildCollectionEach()
        {
            var tree = PrtgNode.Group(Group("PRTG Network Monitor", 0),
                                      PrtgNode.Probe(Probe("Probe 1"),
                                                     PrtgNode.Group(Group(),
                                                                    PrtgNode.TriggerCollection(PrtgNode.Trigger(Trigger()))
                                                                    ),
                                                     PrtgNode.Group(Group("Linux"),
                                                                    PrtgNode.TriggerCollection(PrtgNode.Trigger(Trigger("Ticket Notification")))
                                                                    )
                                                     ),
                                      PrtgNode.Probe(Probe("Probe 2"))
                                      );

            var expected = new[]
            {
                "PRTG Network Monitor",
                "├──Probe 1",
                "│  ├──Servers",
                "│  │  └──Email to Admin",
                "│  └──Linux",
                "│     └──Ticket Notification",
                "└──Probe 2"
            };

            Validate(tree, expected);
        }
コード例 #2
0
ファイル: TreeBuildTests.cs プロジェクト: vijaydairyf/PrtgAPI
        public void Tree_Builds_OrdersChildPositions()
        {
            var tree = PrtgNode.Probe(Probe(),
                                      PrtgNode.TriggerCollection(
                                          PrtgNode.Trigger(Trigger("Trigger1")),
                                          PrtgNode.Trigger(Trigger("Trigger2"))
                                          ),
                                      PrtgNode.Group(Group("Servers", position: 3)),
                                      PrtgNode.Device(Device("dc-1", position: 1),
                                                      PrtgNode.Sensor(Sensor("Sensor2", position: 2)),
                                                      PrtgNode.Sensor(Sensor("Sensor1", position: 1))
                                                      ),
                                      PrtgNode.Trigger(Trigger("Trigger3")),
                                      PrtgNode.Device(Device("dc-2", position: 2))
                                      );

            TreePrettyPrintTests.Validate(tree, new[]
            {
                "Local Probe",
                "├──dc-1",
                "│  ├──Sensor1",
                "│  └──Sensor2",
                "├──dc-2",
                "├──Servers",
                "├──Trigger1",
                "├──Trigger2",
                "└──Trigger3"
            });
        }
コード例 #3
0
        public void Tree_Compare_SecondLastNodeRemoved_LastNodeTriggerCollection()
        {
            var first = PrtgNode.Device(Device(),
                                        PrtgNode.Sensor(Sensor("First Sensor")),
                                        PrtgNode.TriggerCollection(DefaultTrigger)
                                        );

            var second = PrtgNode.Device(Device(),
                                         PrtgNode.TriggerCollection(DefaultTrigger)
                                         );

            ValidatePretty(first, second, new[]
            {
                "<Yellow>dc-1</Yellow>",
                "├──<Red>First Sensor</Red>",
                "└──Triggers",
                "   └──Email to Admin"
            }, new[]
            {
                "<Yellow>dc-1</Yellow>",
                "├──Triggers",
                "│  └──Email to Admin",
                "└──<Green>First Sensor</Green>"
            });
        }
コード例 #4
0
        public void Tree_PrettyPrint_SingleChildCollection()
        {
            var tree = PrtgNode.Probe(Probe(),
                                      PrtgNode.TriggerCollection(PrtgNode.Trigger(Trigger()))
                                      );

            var expected = new[]
            {
                "Local Probe",
                "└──Email to Admin"
            };

            Validate(tree, expected);
        }
コード例 #5
0
        public void Tree_PrettyPrint_TwoCollectionChildren()
        {
            var tree = PrtgNode.Probe(Probe(),
                                      PrtgNode.TriggerCollection(
                                          PrtgNode.Trigger(Trigger()),
                                          PrtgNode.Trigger(Trigger("Ticket Notification"))
                                          )
                                      );

            var expected = new[]
            {
                "Local Probe",
                "├──Email to Admin",
                "└──Ticket Notification"
            };

            Validate(tree, expected);
        }
コード例 #6
0
        public void Tree_PrettyPrint_TwoTriggers()
        {
            var group = Group();

            var tree = PrtgNode.Group(group,
                                      PrtgNode.Trigger(Trigger()),
                                      PrtgNode.TriggerCollection(PrtgNode.Trigger(Trigger("Ticket Notification")))
                                      );

            var expected = new[]
            {
                "Servers",
                "├──Email to Admin",
                "└──Ticket Notification",
            };

            Validate(tree, expected);
        }
コード例 #7
0
        public void Tree_PrettyPrint_TwoChildrenOneGrandChildCollection()
        {
            var tree = PrtgNode.Probe(Probe(),
                                      PrtgNode.Group(Group(),
                                                     PrtgNode.TriggerCollection(PrtgNode.Trigger(Trigger()))
                                                     ),
                                      PrtgNode.Group(Group("Linux", 2002))
                                      );

            var expected = new[]
            {
                "Local Probe",
                "├──Servers",
                "│  └──Email to Admin",
                "└──Linux"
            };

            Validate(tree, expected);
        }