public void ReadTwoLongs()
        {
            using (var buffer = new HeapBuffer(16))
            {
                for (ulong i = 0; i < 16; i++)
                {
                    buffer[i] = (byte)(i + 1);
                }

                var reader = new CheckedReader(buffer);
                reader.ReadLong().Should().Be(0x0807060504030201);
                reader.ReadLong().Should().Be(0x100F0E0D0C0B0A09);
            }
        }
 public void ReadLongInCapacityPasses()
 {
     using (var buffer = new HeapBuffer(8))
     {
         var reader = new CheckedReader(buffer);
         reader.ByteOffset = buffer.ByteCapacity - 8;
         reader.ReadLong();
     }
 }
        public void ReadLong(ulong offset, long expected)
        {
            using (var buffer = new HeapBuffer(16))
            {
                for (ulong i = 0; i < 16; i++)
                {
                    buffer[i] = (byte)(i + 1);
                }

                var reader = new CheckedReader(buffer);
                reader.ByteOffset = offset;
                reader.ReadLong().Should().Be(expected, $"offset is {offset}");
            }
        }
        public void ReadLongPastCapacityFails()
        {
            using (var buffer = new HeapBuffer(sizeof(long)))
            {
                var reader = new CheckedReader(buffer);

                Action action = () => reader.ReadLong();

                for (uint i = 1; i < sizeof(long); i++)
                {
                    reader.ByteOffset = buffer.ByteCapacity - i;
                    action.Should().Throw <System.IO.EndOfStreamException>();
                }
            }
        }