예제 #1
0
        public async Task Add_ActionRuleWithValidParams_IsSuccessAndReturnsRuleID()
        {
            newActionRule = new ActionRule()
            {
                Name          = "UnitTestRule2",
                Enabled       = true,
                Trigger       = new EventTrigger("tns1:PTZController/tnsaxis:PTZPresets/Channel_1", false, "boolean(//SimpleItem[@Name=\"PresetToken\" and @Value=\"-1\"]) and boolean(//SimpleItem[@Name=\"on_preset\" and @Value=\"1\"])"),
                Configuration = new ActionConfiguration()
                {
                    ConfigID = VALID_ACTIONCONFIG_ID
                }
            };

            ServiceResponse response = await actionService.AddActionRuleAsync(VALID_IP, VALID_USER, VALID_PASS, newActionRule);

            if (!response.IsSuccess)
            {
                Console.WriteLine("Error : " + response.Content);
            }
            else
            {
                Console.WriteLine("New action rule id : " + newActionRule.RuleID);
            }

            Assert.IsTrue(response.IsSuccess && !response.SOAPContent.IsEmpty && newActionRule.RuleID != 0);
        }