Exemple #1
0
        public void UnseccessfulNextSearchInEmptyBookmarksContainer()
        {
            IBookmarks bmks = new Bookmarks(CreateBmkFactory());

            var foundBmk = bmks.GetNext(CreateBmk(0, "", 0), true);

            Assert.IsNull(foundBmk);

            foundBmk = bmks.GetNext(CreateBmk(0, "", 0), false);
            Assert.IsNull(foundBmk);
        }
Exemple #2
0
        public void SimpleNextSearchTest()
        {
            IBookmarks bmks = new Bookmarks(CreateBmkFactory());
            var        b1   = bmks.ToggleBookmark(CreateBmk(10, "", 0));
            var        b2   = bmks.ToggleBookmark(CreateBmk(20, "", 0));

            var foundBmk = bmks.GetNext(CreateBmk(0, "", 0), true);

            Assert.AreSame(b1, foundBmk);

            foundBmk = bmks.GetNext(CreateBmk(30, "", 0), false);
            Assert.AreSame(b2, foundBmk);
        }
Exemple #3
0
        public void UnseccessfulNextSearchTest()
        {
            IBookmarks bmks = new Bookmarks(CreateBmkFactory());

            bmks.ToggleBookmark(CreateBmk(10, "", 0));
            bmks.ToggleBookmark(CreateBmk(20, "", 0));

            var foundBmk = bmks.GetNext(CreateBmk(40, "", 0), true);

            Assert.IsNull(foundBmk);

            foundBmk = bmks.GetNext(CreateBmk(5, "", 0), false);
            Assert.IsNull(foundBmk);
        }
Exemple #4
0
        public void SearchByTimestampThatHasManyBookmars()
        {
            IBookmarks bmks = new Bookmarks(CreateBmkFactory());
            var        b0   = bmks.ToggleBookmark(CreateBmk(0, "", 10));
            var        b1   = bmks.ToggleBookmark(CreateBmk(10, "", 300));
            var        b2   = bmks.ToggleBookmark(CreateBmk(10, "", 100));
            var        b3   = bmks.ToggleBookmark(CreateBmk(10, "", 200));
            var        b4   = bmks.ToggleBookmark(CreateBmk(20, "", 1000));

            IBookmark foundBmk;

            foundBmk = bmks.GetNext(CreateBmk(5, "", 0), true);
            Assert.AreSame(b2, foundBmk);

            foundBmk = bmks.GetNext(CreateBmk(10, "", 321), true);
            Assert.AreSame(b4, foundBmk);

            foundBmk = bmks.GetNext(CreateBmk(10, "", 200), true);
            Assert.AreSame(b1, foundBmk);

            foundBmk = bmks.GetNext(CreateBmk(10, "", 234), true);
            Assert.AreSame(b1, foundBmk);

            foundBmk = bmks.GetNext(CreateBmk(10, "", 179), true);
            Assert.AreSame(b3, foundBmk);

            foundBmk = bmks.GetNext(CreateBmk(10, "", 300), true);
            Assert.AreSame(b4, foundBmk);


            foundBmk = bmks.GetNext(CreateBmk(11, "", 0), false);
            Assert.AreSame(b1, foundBmk);

            foundBmk = bmks.GetNext(CreateBmk(10, "", 87), false);
            Assert.AreSame(b0, foundBmk);

            foundBmk = bmks.GetNext(CreateBmk(10, "", 300), false);
            Assert.AreSame(b3, foundBmk);

            foundBmk = bmks.GetNext(CreateBmk(10, "", 100), false);
            Assert.AreSame(b0, foundBmk);

            foundBmk = bmks.GetNext(CreateBmk(10, "", 234), false);
            Assert.AreSame(b3, foundBmk);

            foundBmk = bmks.GetNext(CreateBmk(10, "", 200), false);
            Assert.AreSame(b2, foundBmk);
        }