예제 #1
0
        public void TestBasic_1()
        {
            NativePooledByteBufferOutputStream os1 = new NativePooledByteBufferOutputStream(_pool);
            NativePooledByteBuffer             sb1 = DoWrite(os1, _data);

            Assert.AreEqual(16, sb1._bufRef.Get().Size);
            AssertArrayEquals(_data, GetBytes(sb1), _data.Length);
            _stats.Refresh();
            var testStat = new Dictionary <int, Tuple <int, int> >()
            {
                { 32, new Tuple <int, int>(0, 0) },
                { 16, new Tuple <int, int>(1, 0) },
                { 8, new Tuple <int, int>(0, 1) },
                { 4, new Tuple <int, int>(0, 1) }
            };

            Assert.IsTrue(testStat.All(e => _stats.BucketStats.Contains(e)));
        }
예제 #2
0
        public void TestNewByteBuf_1()
        {
            NativePooledByteBuffer sb1 = (NativePooledByteBuffer)_factory.NewByteBuffer(new MemoryStream(_data));

            Assert.AreEqual(16, sb1._bufRef.Get().Size);
            AssertArrayEquals(_data, GetBytes(sb1), _data.Length);
            _stats.Refresh();
            var testStat = new Dictionary <int, Tuple <int, int> >()
            {
                { 32, new Tuple <int, int>(0, 0) },
                { 16, new Tuple <int, int>(1, 0) },
                { 8, new Tuple <int, int>(0, 1) },
                { 4, new Tuple <int, int>(0, 1) }
            };

            Assert.IsTrue(testStat.All(e => _stats.BucketStats.Contains(e)));
        }