BloomTests.AssertXmlCommands.HasSpecifiedNumberOfMatchesForXpath C# (CSharp) Method

HasSpecifiedNumberOfMatchesForXpath() public method

Will honor default namespace
public HasSpecifiedNumberOfMatchesForXpath ( string xpath, int count ) : void
xpath string
count int
return void
        public void HasSpecifiedNumberOfMatchesForXpath(string xpath, int count)
        {
            var nodes = NodeOrDom.SafeSelectNodes(xpath);
            if (nodes==null)
            {
                Console.WriteLine("Expected {0} but got 0 matches for {1}",count,  xpath);
                PrintNodeToConsole(NodeOrDom);
                Assert.AreEqual(count,0);
            }
            else if (nodes.Count != count)
            {
                Console.WriteLine("Expected {0} but got {1} matches for {2}",count, nodes.Count, xpath);
                PrintNodeToConsole(NodeOrDom);
                Assert.AreEqual(count, nodes.Count, "matches for "+xpath);
            }
        }