public void GetNodeMethodTest(string input, string xpath, string text)
        {
            // ARRANGE: NEW Content(s)
            var contents = new HtmlContentCollection(input);

            // Output Blank
            Debug.WriteLine("");

            // ACT
            var nodes = contents.GetNodes(xpath) as List <HtmlContent>;

            // ASSERT
            Assert.AreEqual(text, nodes[0].Contents.Text);
        }
コード例 #2
0
        // ----------------------------------------------------------------------------------------------------
        // Post-Processing Operations
        // ----------------------------------------------------------------------------------------------------
        // (None)


        // ----------------------------------------------------------------------------------------------------
        // Private Method(s)
        // ----------------------------------------------------------------------------------------------------

        // Write Output according parameter
        private void WriteContents(HtmlContentCollection contents)
        {
            // Check Node Parameter
            if (!string.IsNullOrEmpty(this.Node))
            {
                // Node Parameter is specified.

                // GET Nodes
                var nodes = contents.GetNodes(this.Node);

                // OUTPUT Node Texts
                nodes.ToList().ConvertAll(node => node.Contents?.Text).ForEach(text => this.WriteObject(text));
            }
            else
            {
                // Node Parameter is NOT specified.

                // OUTPUT Contents
                this.WriteObject(contents);
            }
        }