Ejemplo n.º 1
0
        public void PostNodeSurvivesMissingAuthor()
        {
            // ARRANGE: load sample Html from file into an HNPostNode object
            var doc  = ResourceLoader.LoadHtmlDocument(POST_WITHOUT_AUTHOR_OR_POINTS);
            var node = new HNPostNode(doc.DocumentNode.QuerySelector("tr.athing"));

            // ACT: retrieve author from the node
            var author = node.Author;

            // ASSERT: should run OK with missing author node
            Assert.Equal("", author);
        }
Ejemplo n.º 2
0
        public void PostNodeRetrievesRank()
        {
            // ARRANGE: load sample Html from file into an HNPostNode object
            var doc  = ResourceLoader.LoadHtmlDocument(NORMAL_POST);
            var node = new HNPostNode(doc.DocumentNode.QuerySelector("tr.athing"));

            // ACT: retrieve points from the node
            var rank = node.Rank;

            // ASSERT: should find correct points
            Assert.Equal(4, rank);
        }
Ejemplo n.º 3
0
        public void PostNodeRetrievesAuthor()
        {
            // ARRANGE: load sample Html from file into an HNPostNode object
            var doc  = ResourceLoader.LoadHtmlDocument(NORMAL_POST);
            var node = new HNPostNode(doc.DocumentNode.QuerySelector("tr.athing"));

            // ACT: retrieve author from the node
            var author = node.Author;

            // ASSERT: should find correct author
            Assert.Equal("feross", author);
        }
Ejemplo n.º 4
0
        public void PostNodeRetrievesUri()
        {
            // ARRANGE: load sample Html from file into an HNPostNode object
            var doc  = ResourceLoader.LoadHtmlDocument(NORMAL_POST);
            var node = new HNPostNode(doc.DocumentNode.QuerySelector("tr.athing"));

            // ACT: retrieve uri from the node
            var uri = node.Uri;

            // ASSERT: should find correct uri
            Assert.Equal("https://krebsonsecurity.com/2020/04/war-dialing-tool-exposes-zooms-password-problems/", uri);
        }
Ejemplo n.º 5
0
        public void PostNodeRetrievesTitle()
        {
            // ARRANGE: load sample Html from file into an HNPostNode object
            var doc  = ResourceLoader.LoadHtmlDocument(NORMAL_POST);
            var node = new HNPostNode(doc.DocumentNode.QuerySelector("tr.athing"));

            // ACT: retrieve title from the node
            var title = node.Title;

            // ASSERT: should find correct title
            Assert.Equal("‘War Dialing’ tool exposes Zoom’s password problems", title);
        }
Ejemplo n.º 6
0
        public void PostNodeSurvivesMissingComments()
        {
            // ARRANGE: load sample Html from file into an HNPostNode object
            var doc  = ResourceLoader.LoadHtmlDocument(POST_WITHOUT_COMMENTS);
            var node = new HNPostNode(doc.DocumentNode.QuerySelector("tr.athing"));

            // ACT: retrieve comments from the node
            var comments = node.Comments;

            // ASSERT: should run OK with missing points node
            Assert.Equal(0, comments);
        }