1 // Licensed to the .NET Foundation under one or more agreements.
2 // The .NET Foundation licenses this file to you under the MIT license.
3 // See the LICENSE file in the project root for more information.
4 
5 using System.Runtime.InteropServices;
6 using System.Threading;
7 using Xunit;
8 
9 public partial class ThreadPoolBoundHandleTests
10 {
11     [Fact]
12     [PlatformSpecific(TestPlatforms.Windows)] // ThreadPoolBoundHandle.BindHandle is not supported on Unix
Handle_ReturnsHandle()13     public void Handle_ReturnsHandle()
14     {
15         using(SafeHandle handle = HandleFactory.CreateAsyncFileHandleForWrite(GetTestFilePath()))
16         {
17             using(ThreadPoolBoundHandle boundHandle = CreateThreadPoolBoundHandle(handle))
18             {
19                 Assert.Same(boundHandle.Handle, handle);
20             }
21         }
22     }
23 
24     [Fact]
25     [PlatformSpecific(TestPlatforms.Windows)] // ThreadPoolBoundHandle.BindHandle is not supported on Unix
Handle_AfterDisposed_DoesNotThrow()26     public void Handle_AfterDisposed_DoesNotThrow()
27     {
28         using(SafeHandle handle = HandleFactory.CreateAsyncFileHandleForWrite(GetTestFilePath()))
29         {
30             ThreadPoolBoundHandle boundHandle = CreateThreadPoolBoundHandle(handle);
31             boundHandle.Dispose();
32 
33             Assert.Same(boundHandle.Handle, handle);
34         }
35     }
36 }
37