Ejemplo n.º 1
0
        public void ExpandTest()
        {
            BitStreamer bs = new BitStreamer();

            bs.ResetWrite(7);
            Assert.AreEqual(8, bs.ByteLength);

            bs.WriteLong(1);
            bs.WriteLong(2);

            Assert.AreEqual(16, bs.ByteLength);
        }
Ejemplo n.º 2
0
        public void ExpandFailTest()
        {
            BitStreamer bs  = new BitStreamer();
            IntPtr      ptr = Marshal.AllocHGlobal(9);

            bs.ResetWrite(ptr, 9, false);
            Assert.AreEqual(8, bs.ByteLength);

            bs.WriteLong(1);

            Assert.Throws <InvalidOperationException>(() =>
            {
                bs.WriteLong(2);
            });

            Assert.AreEqual(8, bs.ByteLength);
        }