Example #1
0
        public void AddAndDropFutureTest_MaxedOut()
        {
            CyclicFastDrop <int> buffer = new CyclicFastDrop <int>(3);

            buffer.AddAndDropFuture(1);
            buffer.AddAndDropFuture(2);
            buffer.AddAndDropFuture(3);
            buffer.AddAndDropFuture(4);
            buffer.AddAndDropFuture(5);

            AssertArrayEqual <int>(buffer, new int[] { 3, 4, 5 });
            Assert.AreEqual(buffer.CurrentPosition, 2);
        }
Example #2
0
        public void AddAndDropFutureTest_DropFuture()
        {
            CyclicFastDrop <int> buffer = new CyclicFastDrop <int>(10);

            buffer.AddAndDropFuture(1);
            buffer.AddAndDropFuture(2);
            buffer.AddAndDropFuture(3);

            buffer.CurrentPosition = 1;
            buffer.AddAndDropFuture(4);

            AssertArrayEqual <int>(buffer, new int[] { 1, 2, 4 });
        }
Example #3
0
        public void AddAndDropFutureTest_Empty_Same()
        {
            CyclicFastDrop <int> buffer = new CyclicFastDrop <int>(10);

            Assert.AreEqual(0, buffer.Size());

            buffer.AddAndDropFuture(1);
            Assert.AreEqual(1, buffer.Size());

            // Check we dont add the same
            buffer.AddAndDropFuture(1);
            Assert.AreEqual(1, buffer.Size());

            buffer.AddAndDropFuture(2);
            Assert.AreEqual(2, buffer.Size());
        }
Example #4
0
        public void Navigated(Utils.LogFileHandler myHistoryHandler, Uri url, string title)
        {
            HistoryItem newItem = new HistoryItem()
            {
                URL = url, Title = title
            };

            myCyclicHistory.AddAndDropFuture(newItem);
            myHistoryHandler.SaveUrlToFile(title, url.ToString());
        }
Example #5
0
        public void AddAndDropFutureTest_MaxedOut_Drop()
        {
            CyclicFastDrop <int> buffer = new CyclicFastDrop <int>(3);

            buffer.AddAndDropFuture(1);
            buffer.AddAndDropFuture(2);
            buffer.AddAndDropFuture(3);
            buffer.AddAndDropFuture(4);
            buffer.AddAndDropFuture(5);

            // Should be [ 3 , 4 , 5 ] The last

            buffer.CurrentPosition--; // Point on 4

            buffer.AddAndDropFuture(6);
            buffer.AddAndDropFuture(7);

            AssertArrayEqual <int>(buffer, new int[] { 4, 6, 7 });

            Assert.AreEqual(buffer.CurrentPosition, 2);
        }