Exemplo n.º 1
0
 public void ByRefSameValue_UsesSameHandleInstance()
 {
     using NativeExportsNE.NativeExportsSafeHandle handleToDispose = NativeExportsNE.AllocateHandle();
     NativeExportsNE.NativeExportsSafeHandle handle = handleToDispose;
     NativeExportsNE.ModifyHandle(ref handle, newHandle: false);
     Assert.Same(handleToDispose, handle);
 }
Exemplo n.º 2
0
        public void ReturnValue_CreatesSafeHandle()
        {
            using NativeExportsNE.NativeExportsSafeHandle handle = NativeExportsNE.AllocateHandle();

            Assert.False(handle.IsClosed);
            Assert.False(handle.IsInvalid);
        }
Exemplo n.º 3
0
 public void ByRefDifferentValue_UsesNewHandleInstance()
 {
     using NativeExportsNE.NativeExportsSafeHandle handleToDispose = NativeExportsNE.AllocateHandle();
     NativeExportsNE.NativeExportsSafeHandle handle = handleToDispose;
     NativeExportsNE.ModifyHandle(ref handle, newHandle: true);
     Assert.NotSame(handleToDispose, handle);
     handle.Dispose();
 }
Exemplo n.º 4
0
 public void ByValue_CorrectlyUnwrapsHandle()
 {
     using NativeExportsNE.NativeExportsSafeHandle handle = NativeExportsNE.AllocateHandle();
     Assert.True(NativeExportsNE.IsHandleAlive(handle));
 }
Exemplo n.º 5
0
 public void ReturnValue_CreatesSafeHandle_DirectConstructorCall()
 {
     using NativeExportsNE.NativeExportsSafeHandle handle = NativeExportsNE.NativeExportsSafeHandle.CreateNewHandle();
     Assert.False(handle.IsClosed);
     Assert.False(handle.IsInvalid);
 }