Beispiel #1
0
        public void Take_MultipleTakes_ProperlyReturnsData()
        {
            var buffer = new ChunksBuffer();

            var expected = new byte[] { 3, 4, 5 };

            buffer.Add(new byte[2]);
            buffer.Add(expected);

            buffer.Take(2);
            var received = buffer.Take(3);

            Assert.That(received, Is.EqualTo(expected));
        }
Beispiel #2
0
        public void Take_SizeGreaterThanBufferSize_ReturnsSizeEqualToBufferSize()
        {
            var buffer = new ChunksBuffer();

            buffer.Add(new byte[1]);
            var received = buffer.Take(2);

            Assert.That(received.Count, Is.EqualTo(1));
        }