Beispiel #1
0
        public void BitStream_ReadUInt64_Throws_If_Reading_Less_Than_One_Or_More_Than_64_Bits()
        {
            for (int i = -2; i < 66; ++i)
            {
                _BitStream.Initialise(new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 });

                bool expectException = i < 1 || i > 64;
                bool sawException    = false;
                try {
                    _BitStream.ReadUInt64(i);
                } catch (ArgumentOutOfRangeException) {
                    sawException = true;
                }

                Assert.AreEqual(expectException, sawException, "ReadUInt64 did not behave correctly when asked to read {0} bits", i);
            }
        }