Beispiel #1
0
        public void getPageByUrlStrTest()
        {
            //
            PageBacklog target = new PageBacklog();
            Page        page   = new Page();
            String      urlStr = "http://www.google.de";

            page.urlStr = urlStr;
            target.addPage(page);

            //
            Page actual = target.getPageByUrlStr(urlStr);

            Assert.AreEqual(page, actual);
            Assert.AreEqual(1, target.getBacklogSizeForUndonePages());
            Assert.AreEqual(1, target.getBacklogSizeForAllRegisteredPages());
            Assert.AreEqual(true, target.isBacklogForUndonePagesNotEmpty());

            //
            target.getAndRemovePageFromTopOfTheUndoneStack();
            Assert.AreEqual(0, target.getBacklogSizeForUndonePages());
            Assert.AreEqual(1, target.getBacklogSizeForAllRegisteredPages());

            //
            target.removePage(page);
            Assert.AreEqual(0, target.getBacklogSizeForUndonePages());
            Assert.AreEqual(0, target.getBacklogSizeForAllRegisteredPages());
            Assert.AreEqual(false, target.isBacklogForUndonePagesNotEmpty());

            //
            target.addPage(page);
            target.removePage(page);
            Assert.AreEqual(0, target.getBacklogSizeForUndonePages());
            Assert.AreEqual(0, target.getBacklogSizeForAllRegisteredPages());
            Assert.AreEqual(false, target.isBacklogForUndonePagesNotEmpty());

            //
            target.addPage(page);
            target.getAndRemovePageFromTopOfTheUndoneStack();
            target.addPage(page);
            Assert.AreEqual(0, target.getBacklogSizeForUndonePages());
            Assert.AreEqual(1, target.getBacklogSizeForAllRegisteredPages());
            Assert.AreEqual(false, target.isBacklogForUndonePagesNotEmpty());
        }
Beispiel #2
0
        public void getAndRemovePageFromTopOfTheStackTest()
        {
            //
            PageBacklog target = new PageBacklog();
            Page        page   = new Page();

            page.urlStr = "http://www.google.de";
            target.addPage(page);

            Assert.AreEqual(1, target.getBacklogSizeForUndonePages());

            //
            Page actual = target.getAndRemovePageFromTopOfTheUndoneStack();

            Assert.AreEqual(page, actual);
            Assert.AreEqual(0, target.getBacklogSizeForUndonePages());
        }