Exemplo n.º 1
0
        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"
            });
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
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);
        }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
0
        public void Tree_PrettyPrint_Grouping()
        {
            var tree = PrtgNode.Device(Device(),
                                       PrtgNode.Sensor(Sensor(),
                                                       PrtgNode.Trigger(Trigger())
                                                       ),
                                       PrtgNode.Sensor(Sensor())
                                       );

            var grouping = tree["VMware Datastore"];

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

            Validate(grouping, expected);
        }
Exemplo n.º 7
0
        public void Tree_Compare_TriggerValue_Different()
        {
            //Don't need a test for Same because having a different action on the same trigger
            //is considered a rename, but a value change

            var first = PrtgNode.Device(Device(),
                                        PrtgNode.Trigger(Trigger("Original Action"))
                                        );

            var second = PrtgNode.Device(Device(),
                                         PrtgNode.Trigger(Trigger("Renamed Trigger"))
                                         );

            ValidatePretty(first, second, new[]
            {
                "dc-1",
                "└──<Yellow>Original Action (Renamed 'Renamed Trigger')</Yellow>"
            }, new[]
            {
                "dc-1",
                "└──<Yellow>Renamed Trigger (Renamed 'Original Action')</Yellow>"
            });
        }
Exemplo n.º 8
0
        public void Tree_Compare_SecondLastNodeRemoved_LastNodeTrigger()
        {
            var first = PrtgNode.Device(Device(),
                                        PrtgNode.Trigger(Trigger("First Trigger")),
                                        PrtgNode.Trigger(Trigger("Second Trigger", 2))
                                        );

            var second = PrtgNode.Device(Device(),
                                         PrtgNode.Trigger(Trigger("Second Trigger", 2))
                                         );

            ValidatePretty(first, second, new[]
            {
                "<Yellow>dc-1</Yellow>",
                "├──<Red>First Trigger</Red>",
                "└──Second Trigger"
            }, new[]
            {
                "<Yellow>dc-1</Yellow>",
                "├──Second Trigger",
                "└──<Green>First Trigger</Green>"
            });
        }
Exemplo n.º 9
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);
        }
Exemplo n.º 10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NewTriggerNode"/> class.
 /// </summary>
 public NewTriggerNode() : base((t, c) => PrtgNode.Trigger(t), () => new GetNotificationTrigger())
 {
 }