예제 #1
0
        public void test_buffer_position()
        {
            const int size   = 15;
            const int data   = 123;
            var       buffer = new FastBuffer(size);

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

            buffer.Do(a => a.Write(data));

            Assert.AreEqual(sizeof(int), buffer.GetPosition());
        }
예제 #2
0
        public void test_fast_buffer()
        {
            var expected = Utility.GetTestArray(16);
            var buffer   = new FastBuffer(expected);

            Assert.AreEqual(expected.Length, buffer.GetCapacity());

            Assert.AreSame(expected, buffer.Get());

            Assert.IsTrue(buffer.Do(a => Utility.CheckTestArray(a, expected)));

            Assert.AreEqual(expected.Length, buffer.GetPosition());
        }