Example #1
0
 public void EnsureZeroCapacityDoesNotFreeBuffer()
 {
     using (var buffer = new NativeBuffer(10))
     {
         buffer.DangerousGetHandle().Should().NotBe(IntPtr.Zero);
         buffer.EnsureByteCapacity(0);
         buffer.DangerousGetHandle().Should().NotBe(IntPtr.Zero);
     }
 }
Example #2
0
        public void DisposedBufferIsEmpty()
        {
            var buffer = new NativeBuffer(5);

            buffer.ByteCapacity.Should().Be(5);
            buffer.Dispose();
            buffer.ByteCapacity.Should().Be(0);
            buffer.DangerousGetHandle().Should().Be(IntPtr.Zero);
        }
Example #3
0
 public void FreedBufferIsEmpty()
 {
     using (var buffer = new NativeBuffer(5))
     {
         buffer.ByteCapacity.Should().Be(5);
         buffer.Free();
         buffer.ByteCapacity.Should().Be(0);
         buffer.DangerousGetHandle().Should().Be(IntPtr.Zero);
     }
 }
 internal static IntPtr HandleValueToTrace(NativeBuffer buffer)
 {
     return buffer.DangerousGetHandle();
 }