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 Microsoft.Win32.SafeHandles;
6 
7 namespace System.IO.Pipes.Tests
8 {
9     /// <summary>
10     /// Contains helper methods used in AnonymousPipeTests
11     /// </summary>
12     public class AnonymousPipeTestBase : PipeTestBase
13     {
CreateServerClientPair()14         protected override ServerClientPair CreateServerClientPair()
15         {
16             ServerClientPair ret = new ServerClientPair();
17             ret.readablePipe = new AnonymousPipeServerStream(PipeDirection.In);
18             ret.writeablePipe = new AnonymousPipeClientStream(PipeDirection.Out, ((AnonymousPipeServerStream)ret.readablePipe).ClientSafePipeHandle);
19             return ret;
20         }
21 
StartClient(PipeDirection direction, SafePipeHandle clientPipeHandle)22         protected static void StartClient(PipeDirection direction, SafePipeHandle clientPipeHandle)
23         {
24             using (AnonymousPipeClientStream client = new AnonymousPipeClientStream(direction, clientPipeHandle))
25             {
26                 DoStreamOperations(client);
27             }
28         }
29     }
30 }
31