示例#1
0
        public void ShouldUseObjectEqualityToCompareKeys()
        {
            var buffer = new CoalescingRingBuffer <String, Object>(2);

            buffer.Offer("boo", new Object());
            buffer.Offer("boo", new Object());

            Assert.AreEqual(1, buffer.Size());
        }
        public void RunMemoryLeakTest()
        {
            ICoalescingBuffer<CountingKey, CountingValue> buffer = new CoalescingRingBuffer<CountingKey, CountingValue>(16);
            buffer.Offer(new CountingValue());

            buffer.Offer(new CountingKey(1), new CountingValue());
            buffer.Offer(new CountingKey(2), new CountingValue());
            buffer.Offer(new CountingKey(1), new CountingValue());

            buffer.Offer(new CountingValue());

            Assert.AreEqual(4, buffer.Size());
            buffer.Poll(new List<CountingValue>(), 1);
            buffer.Poll(new List<CountingValue>());
            Assert.True(buffer.IsEmpty());

            buffer.Offer(null); // to trigger the clean
        }
示例#3
0
        public void RunMemoryLeakTest()
        {
            ICoalescingBuffer <CountingKey, CountingValue> buffer = new CoalescingRingBuffer <CountingKey, CountingValue>(16);

            buffer.Offer(new CountingValue());

            buffer.Offer(new CountingKey(1), new CountingValue());
            buffer.Offer(new CountingKey(2), new CountingValue());
            buffer.Offer(new CountingKey(1), new CountingValue());

            buffer.Offer(new CountingValue());

            Assert.AreEqual(4, buffer.Size());
            buffer.Poll(new List <CountingValue>(), 1);
            buffer.Poll(new List <CountingValue>());
            Assert.True(buffer.IsEmpty());

            buffer.Offer(null); // to trigger the clean
        }
        public void ShouldUseObjectEqualityToCompareKeys()
        {
            var buffer = new CoalescingRingBuffer<String, Object>(2);

            buffer.Offer("boo", new Object());
            buffer.Offer("boo", new Object());

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