当前位置: 首页>>代码示例>>C#>>正文


C# HtmlDocument.TabularData方法代码示例

本文整理汇总了C#中HtmlAgilityPack.HtmlDocument.TabularData方法的典型用法代码示例。如果您正苦于以下问题:C# HtmlDocument.TabularData方法的具体用法?C# HtmlDocument.TabularData怎么用?C# HtmlDocument.TabularData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HtmlAgilityPack.HtmlDocument的用法示例。


在下文中一共展示了HtmlDocument.TabularData方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: op_TabularData_HtmlDocument_whenDuplicateId

        public void op_TabularData_HtmlDocument_whenDuplicateId()
        {
            var html = new HtmlDocument();
            html.Load(new FileInfo("tabular-duplicate.html").FullName);

            Assert.NotNull(html.TabularData().Tables["duplicate"]);
        }
开发者ID:KarlDirck,项目名称:cavity,代码行数:7,代码来源:HtmlDocument.ExtensionMethods.Facts.cs

示例2: op_TabularData_HtmlDocument_whenEmptyTable

        public void op_TabularData_HtmlDocument_whenEmptyTable()
        {
            var html = new HtmlDocument();
            html.Load(new FileInfo("tabular-empty-table.html").FullName);

            var table = html.TabularData().Tables["empty-table"];

            Assert.Empty(table.Rows);
        }
开发者ID:KarlDirck,项目名称:cavity,代码行数:9,代码来源:HtmlDocument.ExtensionMethods.Facts.cs

示例3: op_TabularData_HtmlDocument_whenCaption

        public void op_TabularData_HtmlDocument_whenCaption()
        {
            var html = new HtmlDocument();
            html.Load(new FileInfo("tabular-caption.html").FullName);

            var table = html.TabularData().Tables["Caption"];

            Assert.Equal(1, table.Rows.Count);
            Assert.Equal("data", table.Rows[0].Field<HtmlNode>(0).InnerText);
        }
开发者ID:KarlDirck,项目名称:cavity,代码行数:10,代码来源:HtmlDocument.ExtensionMethods.Facts.cs

示例4: op_TabularData_HtmlDocument_whenCellColumnSpanning

        public void op_TabularData_HtmlDocument_whenCellColumnSpanning()
        {
            var html = new HtmlDocument();
            html.Load(new FileInfo("tabular-cell-colspan.html").FullName);

            var table = html.TabularData().Tables["cell-colspan"];

            Assert.Equal(2, table.Rows.Count);
            Assert.Equal("1A", table.Rows[0].Field<HtmlNode>(0).InnerText);
            Assert.Equal("1B", table.Rows[0].Field<HtmlNode>(1).InnerText);
            Assert.Equal("1C", table.Rows[0].Field<HtmlNode>(2).InnerText);
            Assert.Equal("1D", table.Rows[0].Field<HtmlNode>(3).InnerText);
            Assert.Equal("2A", table.Rows[1].Field<HtmlNode>("Column A").InnerText);
            Assert.Equal("2B + 2C", table.Rows[1].Field<HtmlNode>("Column B").InnerText);
            Assert.Equal("2B + 2C", table.Rows[1].Field<HtmlNode>("Column C").InnerText);
            Assert.Equal("2D", table.Rows[1].Field<HtmlNode>("Column D").InnerText);
        }
开发者ID:KarlDirck,项目名称:cavity,代码行数:17,代码来源:HtmlDocument.ExtensionMethods.Facts.cs

示例5: GetData

        public override IEnumerable<object[]> GetData(MethodInfo methodUnderTest,
                                                      Type[] parameterTypes)
        {
            if (null == methodUnderTest)
            {
                throw new ArgumentNullException("methodUnderTest");
            }

            if (null == parameterTypes)
            {
                throw new ArgumentNullException("parameterTypes");
            }

#if NET20
            if (IEnumerableExtensionMethods.Count(Files) != parameterTypes.Length)
            {
                throw new InvalidOperationException(StringExtensionMethods.FormatWith(Resources.Attribute_CountsDiffer, IEnumerableExtensionMethods.Count(Files), parameterTypes.Length));
            }
#else
            if (Files.Count() != parameterTypes.Length)
            {
                throw new InvalidOperationException(Resources.Attribute_CountsDiffer.FormatWith(Files.Count(), parameterTypes.Length));
            }
#endif

            var list = new List<object>();
            var index = -1;
            foreach (var file in Files)
            {
                var info = new FileInfo(file);
                index++;
                if (parameterTypes[index] == typeof(HtmlDocument) || parameterTypes[index] == typeof(IXPathNavigable))
                {
                    var html = new HtmlDocument();
                    html.Load(info.FullName);

                    list.Add(html);
                    continue;
                }

                if (parameterTypes[index] == typeof(XPathNavigator))
                {
                    var html = new HtmlDocument();
                    html.Load(info.FullName);

                    list.Add(html.CreateNavigator());
                    continue;
                }

                if (parameterTypes[index] == typeof(DataSet))
                {
                    var html = new HtmlDocument();
                    html.Load(info.FullName);
#if NET20
                    list.Add(HtmlDocumentExtensionMethods.TabularData(html));
#else
                    list.Add(html.TabularData());
#endif
                    continue;
                }

                throw new InvalidOperationException(Resources.HtmlAttribute_UnsupportedParameterType);
            }

            yield return list.ToArray();
        }
开发者ID:KarlDirck,项目名称:cavity,代码行数:66,代码来源:HtmlFileAttribute.cs

示例6: op_TabularData_HtmlDocument_whenHeadingColumnId

        public void op_TabularData_HtmlDocument_whenHeadingColumnId()
        {
            var html = new HtmlDocument();
            html.Load(new FileInfo("tabular-heading-id.html").FullName);

            var table = html.TabularData().Tables["heading-id"];

            Assert.Equal(2, table.Rows.Count);

            Assert.Equal("1A", table.Rows[0].Field<HtmlNode>(0).InnerText);
            Assert.Equal("2A", table.Rows[1].Field<HtmlNode>("A").InnerText);
        }
开发者ID:KarlDirck,项目名称:cavity,代码行数:12,代码来源:HtmlDocument.ExtensionMethods.Facts.cs

示例7: op_TabularData_HtmlDocument_withoutTables

        public void op_TabularData_HtmlDocument_withoutTables()
        {
            var html = new HtmlDocument();
            html.Load(new FileInfo("tabular-empty.html").FullName);

            Assert.Empty(html.TabularData().Tables);
        }
开发者ID:KarlDirck,项目名称:cavity,代码行数:7,代码来源:HtmlDocument.ExtensionMethods.Facts.cs

示例8: op_TabularData_HtmlDocument_whenVerticalHeadingRowSpanning

        public void op_TabularData_HtmlDocument_whenVerticalHeadingRowSpanning()
        {
            var html = new HtmlDocument();
            html.Load(new FileInfo("tabular-vertical-heading-rowspan.html").FullName);

            var table = html.TabularData().Tables["vertical-heading-rowspan"];

            Assert.Equal(2, table.Rows.Count);
            Assert.Equal("1A", table.Rows[0].Field<HtmlNode>(0).InnerText);
            Assert.Equal("2A", table.Rows[1].Field<HtmlNode>(0).InnerText);
            Assert.Equal("1B", table.Rows[0].Field<HtmlNode>("Value B, C (1)").InnerText);
            Assert.Equal("2B", table.Rows[1].Field<HtmlNode>("Value B, C (1)").InnerText);
            Assert.Equal("1C", table.Rows[0].Field<HtmlNode>("Value B, C (2)").InnerText);
            Assert.Equal("2C", table.Rows[1].Field<HtmlNode>("Value B, C (2)").InnerText);
            Assert.Equal("1D", table.Rows[0].Field<HtmlNode>("Value D").InnerText);
            Assert.Equal("2D", table.Rows[1].Field<HtmlNode>("Value D").InnerText);
        }
开发者ID:KarlDirck,项目名称:cavity,代码行数:17,代码来源:HtmlDocument.ExtensionMethods.Facts.cs

示例9: op_TabularData_HtmlDocument_whenVertical

        public void op_TabularData_HtmlDocument_whenVertical()
        {
            var html = new HtmlDocument();
            html.Load(new FileInfo("tabular-vertical.html").FullName);

            var table = html.TabularData().Tables["vertical"];

            Assert.Equal(2, table.Rows.Count);
            Assert.Equal("1A", table.Rows[0].Field<HtmlNode>(0).InnerText);
            Assert.Equal("2A", table.Rows[1].Field<HtmlNode>(0).InnerText);
            Assert.Equal("2B", table.Rows[1].Field<HtmlNode>("Value B").InnerText);
        }
开发者ID:KarlDirck,项目名称:cavity,代码行数:12,代码来源:HtmlDocument.ExtensionMethods.Facts.cs

示例10: op_TabularData_HtmlDocument_whenUnnamed

        public void op_TabularData_HtmlDocument_whenUnnamed()
        {
            var html = new HtmlDocument();
            html.Load(new FileInfo("tabular-unnamed.html").FullName);

            var table = html.TabularData().Tables[0];

            Assert.Equal(1, table.Rows.Count);

            Assert.Equal("_<em>_</em>_", table.Rows[0].Field<HtmlNode>(0).InnerHtml);
        }
开发者ID:KarlDirck,项目名称:cavity,代码行数:11,代码来源:HtmlDocument.ExtensionMethods.Facts.cs

示例11: op_TabularData_HtmlDocument_whenHeadingComplex

        public void op_TabularData_HtmlDocument_whenHeadingComplex()
        {
            var html = new HtmlDocument();
            html.Load(new FileInfo("tabular-heading-complex.html").FullName);

            var table = html.TabularData().Tables["heading-complex"];

            Assert.Equal(2, table.Rows.Count);
            Assert.Equal("Friday, January 01, 2010", table.Rows[0].Field<HtmlNode>(0).InnerText);
            Assert.Equal("26.6", table.Rows[0].Field<HtmlNode>(1).InnerText);
            Assert.Equal("31.8", table.Rows[0].Field<HtmlNode>(2).InnerText);
            Assert.Equal("35.8", table.Rows[0].Field<HtmlNode>(3).InnerText);
            Assert.Equal("Saturday, December 31, 2011", table.Rows[1].Field<HtmlNode>("date").InnerText);
            Assert.Equal("40.5", table.Rows[1].Field<HtmlNode>("minimum-temperature").InnerText);
            Assert.Equal("52.8", table.Rows[1].Field<HtmlNode>("mean-temperature").InnerText);
            Assert.Equal("55.4", table.Rows[1].Field<HtmlNode>("maximum-temperature").InnerText);
        }
开发者ID:KarlDirck,项目名称:cavity,代码行数:17,代码来源:HtmlDocument.ExtensionMethods.Facts.cs


注:本文中的HtmlAgilityPack.HtmlDocument.TabularData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。