@@ -89,16 +89,42 @@ public static void InvalidPipeDirection_Throws_ArgumentOutOfRangeException()
89
89
Assert . Throws < ArgumentOutOfRangeException > ( "direction" , ( ) => new NamedPipeServerStream ( "tempx" , ( PipeDirection ) 123 , 1 , PipeTransmissionMode . Byte , PipeOptions . None , 0 , 0 ) ) ;
90
90
}
91
91
92
+ [ Theory ]
93
+ [ InlineData ( 0 ) ]
94
+ [ InlineData ( - 2 ) ]
95
+ public static void InvalidServerInstances_Throws_ArgumentOutOfRangeException ( int numberOfServerInstances )
96
+ {
97
+ Assert . Throws < ArgumentOutOfRangeException > ( "maxNumberOfServerInstances" , ( ) => new NamedPipeServerStream ( "temp3" , PipeDirection . In , numberOfServerInstances ) ) ;
98
+ Assert . Throws < ArgumentOutOfRangeException > ( "maxNumberOfServerInstances" , ( ) => new NamedPipeServerStream ( "temp3" , PipeDirection . In , numberOfServerInstances , PipeTransmissionMode . Byte ) ) ;
99
+ Assert . Throws < ArgumentOutOfRangeException > ( "maxNumberOfServerInstances" , ( ) => new NamedPipeServerStream ( "temp3" , PipeDirection . In , numberOfServerInstances , PipeTransmissionMode . Byte , PipeOptions . None ) ) ;
100
+ Assert . Throws < ArgumentOutOfRangeException > ( "maxNumberOfServerInstances" , ( ) => new NamedPipeServerStream ( "temp3" , PipeDirection . In , numberOfServerInstances , PipeTransmissionMode . Byte , PipeOptions . None , 0 , 0 ) ) ;
101
+ }
102
+
92
103
[ Theory ]
93
104
[ InlineData ( PipeDirection . In ) ]
94
105
[ InlineData ( PipeDirection . InOut ) ]
95
106
[ InlineData ( PipeDirection . Out ) ]
96
- public static void InvalidServerInstances_Throws_ArgumentOutOfRangeException ( PipeDirection direction )
107
+ [ PlatformSpecific ( PlatformID . AnyUnix ) ]
108
+ public static void Unix_ServerInstancesOver254_Allowed ( PipeDirection direction )
109
+ {
110
+ // MaxNumberOfServerInstances has functionality on Unix and as such is not upper bound.
111
+ new NamedPipeServerStream ( GetUniquePipeName ( ) , direction , 255 ) . Dispose ( ) ;
112
+ new NamedPipeServerStream ( GetUniquePipeName ( ) , direction , 255 , PipeTransmissionMode . Byte ) . Dispose ( ) ;
113
+ new NamedPipeServerStream ( GetUniquePipeName ( ) , direction , 255 , PipeTransmissionMode . Byte , PipeOptions . None ) . Dispose ( ) ;
114
+ new NamedPipeServerStream ( GetUniquePipeName ( ) , direction , 255 , PipeTransmissionMode . Byte , PipeOptions . None , 0 , 0 ) . Dispose ( ) ;
115
+ }
116
+
117
+ [ Theory ]
118
+ [ InlineData ( PipeDirection . In ) ]
119
+ [ InlineData ( PipeDirection . InOut ) ]
120
+ [ InlineData ( PipeDirection . Out ) ]
121
+ [ PlatformSpecific ( PlatformID . Windows ) ]
122
+ public static void Windows_ServerInstancesOver254_Throws_ArgumentOutOfRangeException ( PipeDirection direction )
97
123
{
98
- Assert . Throws < ArgumentOutOfRangeException > ( "maxNumberOfServerInstances" , ( ) => new NamedPipeServerStream ( "temp3" , direction , 0 ) ) ;
99
- Assert . Throws < ArgumentOutOfRangeException > ( "maxNumberOfServerInstances" , ( ) => new NamedPipeServerStream ( "temp3" , direction , 0 , PipeTransmissionMode . Byte ) ) ;
100
- Assert . Throws < ArgumentOutOfRangeException > ( "maxNumberOfServerInstances" , ( ) => new NamedPipeServerStream ( "temp3" , direction , 0 , PipeTransmissionMode . Byte , PipeOptions . None ) ) ;
101
- Assert . Throws < ArgumentOutOfRangeException > ( "maxNumberOfServerInstances" , ( ) => new NamedPipeServerStream ( "temp3" , direction , 0 , PipeTransmissionMode . Byte , PipeOptions . None , 0 , 0 ) ) ;
124
+ Assert . Throws < ArgumentOutOfRangeException > ( "maxNumberOfServerInstances" , ( ) => new NamedPipeServerStream ( "temp3" , direction , 255 ) ) ;
125
+ Assert . Throws < ArgumentOutOfRangeException > ( "maxNumberOfServerInstances" , ( ) => new NamedPipeServerStream ( "temp3" , direction , 255 , PipeTransmissionMode . Byte ) ) ;
126
+ Assert . Throws < ArgumentOutOfRangeException > ( "maxNumberOfServerInstances" , ( ) => new NamedPipeServerStream ( "temp3" , direction , 255 , PipeTransmissionMode . Byte , PipeOptions . None ) ) ;
127
+ Assert . Throws < ArgumentOutOfRangeException > ( "maxNumberOfServerInstances" , ( ) => new NamedPipeServerStream ( "temp3" , direction , 255 , PipeTransmissionMode . Byte , PipeOptions . None , 0 , 0 ) ) ;
102
128
}
103
129
104
130
[ Theory ]
0 commit comments