public void EnsureMemoryCleaned() { var x = new DisposableUnmanagedMemory(sizeof(int)); Marshal.WriteInt32(x.Handler, 42); x.Dispose(); Assert.AreEqual(x.Handler, IntPtr.Zero); }
public void SuccessUsageOfRegularAllocator() { var x = new DisposableUnmanagedMemory(sizeof(int)); Marshal.WriteInt32(x.Handler, 42); var result = Marshal.ReadInt32(x.Handler); x.Dispose(); Assert.AreEqual(result, 42); }