@@ -40,43 +40,16 @@ public void Test_PipeStream_Write_Read_Byte()
40
40
var testBuffer = new byte [ 1024 ] ;
41
41
new Random ( ) . NextBytes ( testBuffer ) ;
42
42
43
- var outputBuffer = new byte [ 1024 ] ;
44
-
45
43
using ( var stream = new PipeStream ( ) )
46
44
{
47
45
stream . Write ( testBuffer , 0 , testBuffer . Length ) ;
48
-
49
46
Assert . AreEqual ( stream . Length , testBuffer . Length ) ;
50
-
51
47
stream . ReadByte ( ) ;
52
-
53
48
Assert . AreEqual ( stream . Length , testBuffer . Length - 1 ) ;
54
-
55
49
stream . ReadByte ( ) ;
56
-
57
50
Assert . AreEqual ( stream . Length , testBuffer . Length - 2 ) ;
58
51
}
59
52
}
60
- /// <summary>
61
- ///A test for PipeStream Constructor
62
- ///</summary>
63
- [ TestMethod ]
64
- public void PipeStreamConstructorTest ( )
65
- {
66
- PipeStream target = new PipeStream ( ) ;
67
- Assert . Inconclusive ( "TODO: Implement code to verify target" ) ;
68
- }
69
-
70
- /// <summary>
71
- ///A test for Flush
72
- ///</summary>
73
- [ TestMethod ]
74
- public void FlushTest ( )
75
- {
76
- PipeStream target = new PipeStream ( ) ; // TODO: Initialize to an appropriate value
77
- target . Flush ( ) ;
78
- Assert . Inconclusive ( "A method that does not return a value cannot be verified." ) ;
79
- }
80
53
81
54
[ TestMethod ]
82
55
public void Read ( )
@@ -190,10 +163,16 @@ public void CanWriteTest()
190
163
[ TestMethod ]
191
164
public void LengthTest ( )
192
165
{
193
- PipeStream target = new PipeStream ( ) ; // TODO: Initialize to an appropriate value
194
- long actual ;
195
- actual = target . Length ;
196
- Assert . Inconclusive ( "Verify the correctness of this test method." ) ;
166
+ var target = new PipeStream ( ) ;
167
+ Assert . AreEqual ( 0L , target . Length ) ;
168
+ target . Write ( new byte [ ] { 0x0a , 0x05 , 0x0d } , 0 , 2 ) ;
169
+ Assert . AreEqual ( 2L , target . Length ) ;
170
+ target . WriteByte ( 0x0a ) ;
171
+ Assert . AreEqual ( 3L , target . Length ) ;
172
+ target . Read ( new byte [ 2 ] , 0 , 2 ) ;
173
+ Assert . AreEqual ( 1L , target . Length ) ;
174
+ target . ReadByte ( ) ;
175
+ Assert . AreEqual ( 0L , target . Length ) ;
197
176
}
198
177
199
178
/// <summary>
@@ -202,13 +181,10 @@ public void LengthTest()
202
181
[ TestMethod ]
203
182
public void MaxBufferLengthTest ( )
204
183
{
205
- PipeStream target = new PipeStream ( ) ; // TODO: Initialize to an appropriate value
206
- long expected = 0 ; // TODO: Initialize to an appropriate value
207
- long actual ;
208
- target . MaxBufferLength = expected ;
209
- actual = target . MaxBufferLength ;
210
- Assert . AreEqual ( expected , actual ) ;
211
- Assert . Inconclusive ( "Verify the correctness of this test method." ) ;
184
+ var target = new PipeStream ( ) ;
185
+ Assert . AreEqual ( 200 * 1024 * 1024 , target . MaxBufferLength ) ;
186
+ target . MaxBufferLength = 0L ;
187
+ Assert . AreEqual ( 0L , target . MaxBufferLength ) ;
212
188
}
213
189
214
190
[ TestMethod ]
0 commit comments