public void Add_GivenData_ExpectsListWithHeadOnly () { //Given var expected = new linkList (); expected.Head = new Node { Data = 3 }; var ll = new linkList (); //When ll.Add (3); //Then ll.Should ().BeEquivalentTo (expected); }
public void TestName () { //Given var expected = new linkList(); expected.Head = new Node{Data = 3}; expected.Head.Next = new Node{Data = 5}; expected.Head.Next.Next = new Node{Data = 9}; expected.Head.Next.Next.Next = new Node{Data = 1}; expected.Head.Next.Next.Next.Next = new Node{Data = 2}; var ll = new linkList(); //When ll.Add(3); ll.Add(5); ll.Add(9); ll.Add(1); ll.Add(2); //Then ll.Should().BeEquivalentTo(expected); }
/// <summary> /// Processes the specified page. /// </summary> /// <param name="page">The page.</param> /// <returns></returns> public linkList process(crawledPage page, Boolean isLinkStackEmpty) { linkList output = new linkList(); linkList secOutput = new linkList(); // pages.Add(page); if (page == null) { isLinkCollectingDone = true; return(null); //getResult(); } if (CountToTarget < 1) { isLinkCollectingDone = true; return(null); //getResult(); } if (iLimit < 0) { isLinkCollectingDone = true; return(null); //getResult(); } htmlContentPage hContent = page.tokenizedContent as htmlContentPage; if (hContent != null) { htmlLinkNodeCollection linkNodes = new htmlLinkNodeCollection(hContent.tokens); var lnk = linkNodes.getSorted(); foreach (htmlLinkNode ln in lnk) { link crawledLink = null; if (page.links.byUrl.ContainsKey(ln.url)) { crawledLink = page.links.byUrl[ln.url]; } var cwl = Add(crawledLink); if (cwl != null) { if (ln.isPrimary) { primary.Add(crawledLink); output.Add(cwl); } else { secondary.Add(crawledLink); secOutput.Add(crawledLink); } } } } else { } // Int32 cc = CountToTarget - output.Count(); if (!output.Any()) { if (isLinkStackEmpty) { collectionExtensions.AddMulti(output, secondary); } } iLimit--; //if (output.Count() == 0) //{ // isLinkCollectingDone = true; // return getResult(); //} return(output); }