Exemplo n.º 1
0
        public void Push_MoreThanCapacity_False()
        {
            var buffer = new ExporterWriterBuffer <int>(100);

            for (int i = 0; i < 100; i++)
            {
                Assert.True(buffer.Push(i));
            }

            Assert.False(buffer.Push(101));

            // Check NONE element of the buffer was replaced
            var vals     = buffer.Pop();
            var replaced = 0;

            for (int i = 0; i < 100; i++)
            {
                if (vals[i] != i)
                {
                    replaced++;
                }
            }

            Assert.Equal(0, replaced);
        }
Exemplo n.º 2
0
        public void PushPop_1ElementIn_1ElementOut()
        {
            var buffer = new ExporterWriterBuffer <int>(100);

            buffer.Push(42);
            var vals = buffer.Pop();

            Assert.Equal(42, vals.Single());
        }