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); }
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); }
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); }
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); }
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); }
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); }