How do I get out what I put into a stream?
expected: <"expected">
but was: <"expected
I believe it's a null that's causing the failure. The second string is one character longer than the first.
Here's the unit test:
<Test> Public Sub StreamTest()
Dim sr As New StreamReader( New MemoryStream )
Dim sw As New StreamWriter( sr.BaseStream )
sw.AutoFlush = True
Dim expected As String = "expected"
sw.BaseStream.Position = 0
sw.Write( expected )
Dim chars( expected.Length ) As Char
sr.BaseStream.Position = 0
Dim length As Integer
length = sr.Read( chars, 0, chars.Length )
Dim result( length ) As Char
For i As Integer = 0 To length - 1
result(i) = chars(i)
Next
Assert.AreEqual( expected, New string( result ) )
End Sub

