Example #1
0
        bool messageFilterBase(Proxies.Event.NotificationMessageHolderType message,
                               TopicInfo topicInfo,
                               string expectedPropertyOperation,
                               string validationScript)
        {
            if (!string.IsNullOrEmpty(expectedPropertyOperation))
            {
                if (!message.Message.HasAttribute(OnvifMessage.PROPERTYOPERATIONTYPE))
                {
                    return(false);
                }

                XmlAttribute propertyOperationType = message.Message.Attributes[OnvifMessage.PROPERTYOPERATIONTYPE];
                if (expectedPropertyOperation != propertyOperationType.Value)
                {
                    return(false);
                }
            }


            var    logger = new StringBuilder();
            string validationScriptPath = string.Format("TestTool.Tests.TestCases.TestSuites.QuickInstall.Scripts.{0}", validationScript);

            Assert(ValidationEngine.GetInstance().Validate(message,
                                                           topicInfo,
                                                           validationScriptPath,
                                                           logger),
                   logger.ToStringTrimNewLine(),
                   "Validate received notification(s)");

            return(true);
        }
Example #2
0
        bool messageFilterBase(Proxies.Event.NotificationMessageHolderType message,
                               TopicInfo topicInfo,
                               string expectedPropertyOperation,
                               string validationScript,
                               IEnumerable <AccessProfile> accessProfileList)
        {
            if (!string.IsNullOrEmpty(expectedPropertyOperation))
            {
                if (!message.Message.HasAttribute(OnvifMessage.PROPERTYOPERATIONTYPE))
                {
                    return(true);
                }

                XmlAttribute propertyOperationType = message.Message.Attributes[OnvifMessage.PROPERTYOPERATIONTYPE];
                if (expectedPropertyOperation != propertyOperationType.Value)
                {
                    return(false);
                }
            }

            var variables = new Dictionary <string, string>();

            variables.Add("accessProfileList", string.Format(@"{{{0}}}", string.Join(",", accessProfileList.Select(s => string.Format(@"""{0}"" : ""{1}""", s.token, s.Description)))));


            var    logger = new StringBuilder();
            string validationScriptPath = string.Format("TestTool.Tests.TestCases.TestSuites.AccessRules.Script.{0}", validationScript);

            Assert(ValidationEngine.GetInstance().Validate(message,
                                                           topicInfo,
                                                           validationScriptPath,
                                                           logger,
                                                           variables),
                   logger.ToStringTrimNewLine(),
                   "Validate received notification(s)");

            return(true);
        }