public void AddNotificationTrigger_TriggerChannel_InvalidChannelId_OnContainer()
        {
            var urls = new[]
            {
                UnitRequest.TriggerTypes(1001),              //Validate Supported Triggers
                UnitRequest.Sensors("filter_objid=1001")     //Validate TriggerChannel target compatibility
            };

            AssertEx.Throws <InvalidOperationException>(() => TestTriggerChannel(new TriggerChannel(99), urls, false), "Channel ID '99' is not a valid channel");
        }
        public void AddNotificationTrigger_TriggerChannel_StandardTriggerChannel_OnSensor()
        {
            var urls = new[]
            {
                UnitRequest.TriggerTypes(1001),              //Validate Supported Triggers
                UnitRequest.Sensors("filter_objid=1001")     //Validate TriggerChannel target compatibility
            };

            AssertEx.Throws <InvalidOperationException>(() => TestTriggerChannel(TriggerChannel.Total, urls, true), "Channel 'Total' is not a valid value");
        }
        public void AddNotificationTrigger_TriggerChannel_StandardTriggerChannel_OnContainer()
        {
            var urls = new[]
            {
                UnitRequest.TriggerTypes(1001),                                                                                                                                                                                   //Validate Supported Triggers
                UnitRequest.Sensors("filter_objid=1001"),                                                                                                                                                                         //Validate TriggerChannel target compatibility
                UnitRequest.EditSettings("id=1001&subid=new&onnotificationid_new=-1%7CNone&class=threshold&offnotificationid_new=-1%7CNone&channel_new=-1&condition_new=0&threshold_new=0&latency_new=60&objecttype=nodetrigger") //Add Trigger
            };

            TestTriggerChannel(TriggerChannel.Total, urls, false);
        }
        public void AddNotificationTrigger_TriggerChannel_ChannelId_OnSensor()
        {
            var urls = new[]
            {
                UnitRequest.TriggerTypes(1001),                                                                                                                                                                                  //Validate Supported Triggers
                UnitRequest.Sensors("filter_objid=1001"),                                                                                                                                                                        //Validate TriggerChannel target compatibility
                UnitRequest.ChannelProperties(1001, 3),
                UnitRequest.EditSettings("id=1001&subid=new&onnotificationid_new=-1%7CNone&class=threshold&offnotificationid_new=-1%7CNone&channel_new=3&condition_new=0&threshold_new=0&latency_new=60&objecttype=nodetrigger") //Add Trigger
            };

            TestTriggerChannel(new TriggerChannel(3), urls, true);
        }
        public void AddNotificationTrigger_TriggerChannel_Channel_WithStandardTriggerChannelName_OnContainer()
        {
            var urls = new[]
            {
                UnitRequest.TriggerTypes(1001),              //Validate Supported Triggers
                UnitRequest.Sensors("filter_objid=1001")     //Validate TriggerChannel target compatibility
            };

            var channel = new Channel
            {
                Name = "Total"
            };

            AssertEx.Throws <InvalidOperationException>(() => TestTriggerChannel(channel, urls, false), "Channel 'Total' of type 'Channel' is not a valid channel");
        }
        public void AddNotificationTrigger_TriggerChannel_Channel_WithStandardTriggerChannelName_OnSensor()
        {
            var urls = new[]
            {
                UnitRequest.TriggerTypes(1001),              //Validate Supported Triggers
                UnitRequest.Sensors("filter_objid=1001"),    //Validate TriggerChannel target compatibility
                UnitRequest.Channels(1001),
                UnitRequest.ChannelProperties(1001, 1),
                UnitRequest.EditSettings("id=1001&subid=new&onnotificationid_new=-1%7CNone&class=threshold&offnotificationid_new=-1%7CNone&channel_new=1&condition_new=0&threshold_new=0&latency_new=60&objecttype=nodetrigger") //Add Trigger
            };

            var channel = new Channel
            {
                Name = "Total",
                Id   = 1
            };

            TestTriggerChannel(channel, urls, true, new ChannelItem(name: "Total", objId: "1"));
        }