Exemplo n.º 1
0
 [PlatformSpecific(TestPlatforms.Windows)] // ThreadPoolBoundHandle.BindHandle is not supported on Unix
 public void BindHandle_SyncHandleAsHandle_ThrowsArgumentException()
 {                                         // Can't bind a handle that was not opened for overlapped I/O
     using (SafeHandle handle = HandleFactory.CreateSyncFileHandleForWrite(GetTestFilePath()))
     {
         AssertExtensions.Throws <ArgumentException>("handle", () =>
         {
             ThreadPoolBoundHandle.BindHandle(handle);
         });
     }
 }
Exemplo n.º 2
0
    [PlatformSpecific(TestPlatforms.Windows)] // ThreadPoolBoundHandle.BindHandle is not supported on Unix
    public void BindHandle_DisposedSyncHandleAsHandle_ThrowsArgumentException()
    {
        Win32Handle handle = HandleFactory.CreateSyncFileHandleForWrite();

        handle.Dispose();

        AssertExtensions.Throws <ArgumentException>("handle", () =>
        {
            ThreadPoolBoundHandle.BindHandle(handle);
        });
    }
Exemplo n.º 3
0
    [PlatformSpecific(TestPlatforms.Windows)] // ThreadPoolBoundHandle.BindHandle is not supported on Unix
    public void BindHandle_ClosedSyncHandleAsHandle_ThrowsArgumentException()
    {
        using (Win32Handle handle = HandleFactory.CreateSyncFileHandleForWrite(GetTestFilePath()))
        {
            handle.CloseWithoutDisposing();

            AssertExtensions.Throws <ArgumentException>("handle", () =>
            {
                ThreadPoolBoundHandle.BindHandle(handle);
            });
        }
    }