public void ViewHistoryWorksCorrectlyWithLink() { var history = new BrowserHistory(); history.Open(new Link("https://www.youtube.com/watch?sdgdfdh", 50)); history.Open(new Link("https://www.youtube.com/watch?sdgdfdt", 60)); history.Open(new Link("https://www.youtube.com/watch?sdgdfds", 70)); string expectedResult = "-- https://www.youtube.com/watch?sdgdfds 70s\r\n" + "-- https://www.youtube.com/watch?sdgdfdt 60s\r\n" + "-- https://www.youtube.com/watch?sdgdfdh 50s\r\n"; string result = history.ViewHistory(); Assert.AreEqual(expectedResult, result); }
public void RemoveLinksWorksCorrectly() { var history = new BrowserHistory(); history.Open(new Link("https://www.youtube.com/watch?sdgdfdf", 100)); history.Open(new Link("https://www.google.com/watch?sdgdfdf", 100)); history.Open(new Link("https://www.youtube.com/watch?sdgdfdf", 100)); history.Open(new Link("https://www.google.com/watch?sdgdfdf", 100)); history.Open(new Link("https://www.youtube.com/watch?sdgdfdf", 100)); history.Open(new Link("https://www.google.com/watch?sdgdfdf", 100)); int actualCount = history.RemoveLinks("youtube"); ILink[] actualLinks = history.ToArray(); Assert.AreEqual(3, history.Size); Assert.AreEqual(3, actualCount); Assert.IsTrue(actualLinks.All(l => !l.Url.Contains("youtube"))); }