Example #1
0
        static void TestIterator()
        {
            var browserHistory = new BrowserHistory();

            browserHistory.Push("URL1");
            browserHistory.Push("URL3");
            browserHistory.Push("URL2");

            var iterator = browserHistory.CreateIterator();

            while (iterator.HasNext())
            {
                System.Console.WriteLine(iterator.Current());
                iterator.Next();
            }

            browserHistory.Pop();
            browserHistory.Pop();
            browserHistory.Pop();

            iterator = browserHistory.CreateIterator();

            while (iterator.HasNext())
            {
                System.Console.WriteLine(iterator.Current());
                iterator.Next();
            }
        }
 public void TestMethod1()
 {
     var firefoxHistories = BrowserHistory.GetHistory(Browser.Firefox);
     var chromeHistories  = BrowserHistory.GetHistory(Browser.Chrome);
     var ieHistories      = BrowserHistory.GetHistory(Browser.InternetExplorer);
     var safariHistories  = BrowserHistory.GetHistory(Browser.Safari);
     var allHistories     = BrowserHistory.GetHistory(Browser.All);
 }
        static void Main(string[] args)
        {
            List <URL> urls = BrowserHistory.GetFirefoxHistory();

            foreach (var url in urls)
            {
                Console.WriteLine(url.title);
            }

            Console.ReadKey();
        }
        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);
        }
Example #5
0
        static void Iterator()
        {
            BrowserHistory browserHistory = new BrowserHistory();

            browserHistory.Push("edgias.com");
            browserHistory.Push("apps.edgias.com");
            browserHistory.Push("sales.edgias.com");

            IIterator iterator = browserHistory.CreateIterator();

            while (iterator.HasNext())
            {
                var url = iterator.Current();
                Console.WriteLine(url);
                iterator.Next();
            }
        }
        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")));
        }
Example #7
0
 public ListIterator(BrowserHistory browserHistory)
 {
     _browserHistory = browserHistory;
 }