예제 #1
0
        public RequestMatcher CreateRequestMatcher()
        {
            ThrowExceptionIfAdditionalData();

            RequestMatcher retval;

            if (xpath != null)
            {
                var xpathMatcher = new XPathMatcher(xpath);
                if (namespaces != null)
                {
                    foreach (var jsonNs in namespaces)
                    {
                        jsonNs.ThrowExceptionIfAdditionalData();
                        xpathMatcher.AddNamespace(jsonNs.prefix, jsonNs.ns);
                    }
                }
                retval = xpathMatcher;
            }
            else if (regex != null)
            {
                retval = new RegexMatcher(regex);
            }
            else
            {
                retval = new AnyMatcher();
            }
            if (methods != null)
            {
                retval.SetMatchingHttpMethods(methods);
            }
            return(retval);
        }
예제 #2
0
 public RequestMatcher CreateRequestMatcher()
 {
     if (xpath != null)
     {
         var xpathMatcher = new XPathMatcher(xpath);
         if (namespaces != null)
         {
             foreach (var jsonNs in namespaces)
             {
                 xpathMatcher.AddNamespace(jsonNs.prefix, jsonNs.ns);
             }
         }
         return(xpathMatcher);
     }
     else if (regex != null)
     {
         return(new RegexMatcher(regex));
     }
     return(new AnyMatcher());
 }