public void ReturnsNullWhenTheSizeIsZero() { var target = new MarshallingService(); var result = target.AllocHGlobal(0); Assert.AreEqual(IntPtr.Zero, result); }
public void AllocateThePointerSpecified() { var result = IntPtr.Zero; try { var target = new MarshallingService(); result = target.AllocHGlobal(4); Assert.AreNotEqual(IntPtr.Zero, result); } finally { if (result != IntPtr.Zero) { Marshal.FreeHGlobal(result); } } }
public void ThrowsAnExceptionWhenTheSizeIsLessThanZero() { var target = new MarshallingService(); Assert.Throws <ArgumentException>(() => target.AllocHGlobal(0)); }