Пример #1
0
 public void CannotDecreaseBeyondPosition()
 {
     using (var stream = new RingMemoryStream(SmallBufferSize))
     {
         stream.WriteByte(0);
         stream.SetLength(0);
     }
 }
Пример #2
0
        public void WriteInBytes()
        {
            using (var stream = new RingMemoryStream(SmallBufferSize))
            {
                foreach (byte b in TestData)
                {
                    stream.WriteByte(b);
                }

                stream.Position = 0;

                byte[] buffer = new byte[TestData.Length];

                stream.Read(buffer, 0, buffer.Length);

                Assert.AreEqual(TestData, buffer);
            }
        }
Пример #3
0
        public void GetWriteBufferAfterWrite()
        {
            using (var stream = new RingMemoryStream(SmallBufferSize))
            {
                stream.WriteByte(0);

                var page = stream.GetWriteBuffer();

                Assert.AreEqual(1, stream.PagesAllocated);
                Assert.AreEqual(page.Offset, 1);
                Assert.AreEqual(page.Count, SmallBufferSize - 1);
            }
        }