コード例 #1
0
        public void NoMatch()
        {
            var matcher = new XPathMatcher("//nhn:ssn = '13116900217'");

            matcher.AddNamespace("nhn", "http://register.nhn.no/Orchestration");
            Assert.False(matcher.Matches(null, new Microsoft.AspNetCore.Http.QueryString(), BODY, null));
        }
コード例 #2
0
        public void XPathToStringWithHttpMethods()
        {
            var matcher = new XPathMatcher("/x/path/");

            matcher.SetMatchingHttpMethods("get post");
            Assert.Equal("XPath '/x/path/' (GET,POST)", matcher.ToString());
        }
コード例 #3
0
        public void XPathMatcher_GetName()
        {
            // Assign
            var matcher = new XPathMatcher("X");

            // Act
            string name = matcher.GetName();

            // Assert
            Check.That(name).Equals("XPathMatcher");
        }
コード例 #4
0
        public void XPathMatcher_GetPatterns()
        {
            // Assign
            var matcher = new XPathMatcher("X");

            // Act
            string[] patterns = matcher.GetPatterns();

            // Assert
            Check.That(patterns).ContainsExactly("X");
        }
コード例 #5
0
        public void XPathMatcher_IsMatch_RejectOnMatch()
        {
            // Assign
            string xml     = @"
                    <todo-list>
                        <todo-item id='a1'>abc</todo-item>
                    </todo-list>";
            var    matcher = new XPathMatcher(MatchBehaviour.RejectOnMatch, false, "/todo-list[count(todo-item) = 1]");

            // Act
            double result = matcher.IsMatch(xml);

            // Assert
            Check.That(result).IsEqualTo(0.0);
        }
コード例 #6
0
        public void XPathMatcher_IsMatch_AcceptOnMatch()
        {
            // Assign
            string xml     = @"
                    <todo-list>
                        <todo-item id='a1'>abc</todo-item>
                    </todo-list>";
            var    matcher = new XPathMatcher("/todo-list[count(todo-item) = 1]");

            // Act
            double result = matcher.IsMatch(xml);

            // Assert
            Check.That(result).IsEqualTo(1.0);
        }
コード例 #7
0
        public void XPathToStringWithoutHttpMethods()
        {
            var matcher = new XPathMatcher("/x/path/");

            Assert.Equal("XPath '/x/path/'", matcher.ToString());
        }