Exemple #1
0
        public void ExtractCoordinateTables_ShouldReturnATable_WhenIntermediateSiblings()
        {
            const string data     = @"
<html>
<head></head>
<body>
<h2>Heading 1</h2>
<p>Wibble</p>
<table>
</table>
<h2>Heading 2</h2>
<p>Wibble</p>
<p>Wibble2</p>
<table>
</table>
</body>
</html>";
            var          document = Dcsoup.Parse(data);
            var          tableMap = LocationUpdate.ExtractCoordinateTables(document);

            var enumerable = tableMap as IList <Tuple <string, Element> > ?? tableMap.ToList();

            Assert.True(enumerable.Any(), "No tables were returned.");
            Assert.True(enumerable.First().Item2.TagName == "table", "First result not a table.");
            Assert.True(enumerable.Skip(1).First().Item2.TagName == "table", "Second result not a table.");
        }
Exemple #2
0
        public void ExtractCoordinateTables_ShouldFindAllLocationTables()
        {
            const string data =
                "\r\n<html>\r\n<head></head>\r\n<body>\r\n<h2>Heading 1</h2>\r\n<table>\r\n</table>\r\n<h2>Heading 2</h2>\r\n<table>\r\n</table>\r\n</body>\r\n</html>";
            var document = Dcsoup.Parse(data);
            var tableMap = LocationUpdate.ExtractCoordinateTables(document);

            Assert.Equal(2, tableMap.Count());
        }
Exemple #3
0
        public void ExtractCoordinateTables_ShouldReturnATable()
        {
            const string data =
                "\r\n<html>\r\n<head></head>\r\n<body>\r\n<h2>Heading 1</h2>\r\n<table>\r\n</table>\r\n<h2>Heading 2</h2>\r\n<table>\r\n</table>\r\n</body>\r\n</html>";
            var document = Dcsoup.Parse(data);
            var tableMap = LocationUpdate.ExtractCoordinateTables(document);

            Assert.True(tableMap.First().Item2.TagName == "table");
        }
Exemple #4
0
        public void ExtractCoordinateTables_ShouldCorrectlySubsequentHeadingText()
        {
            const string data =
                "\r\n<html>\r\n<head></head>\r\n<body>\r\n<h2>Heading 1</h2>\r\n<table>\r\n</table>\r\n<h2>Heading 2</h2>\r\n<table>\r\n</table>\r\n</body>\r\n</html>";
            var document = Dcsoup.Parse(data);
            var tableMap = LocationUpdate.ExtractCoordinateTables(document);

            Assert.Contains("Heading 2", tableMap.Select(t => t.Item1));
        }