Read() public method

public Read ( int bytesToRead ) : string
bytesToRead int
return string
示例#1
0
 public void SimpleStringIsRead()
 {
     var testSocket = new TestSocket();
     var socketStream = new SocketSession(testSocket);
     testSocket.PutBytes(new byte[] {104, 101, 108, 108, 111});
     Assert.AreEqual("hello", socketStream.Read(5));
 }
示例#2
0
 public void EncodedStringIsRead()
 {
     var testSocket = new TestSocket();
     var socketStream = new SocketSession(testSocket);
     testSocket.PutBytes(new byte[] {104, 226, 128, 153, 108, 108, 111});
     Assert.AreEqual("h\u2019llo", socketStream.Read(7));
 }
示例#3
0
 public void StringIsReadInMultipleParts()
 {
     var testSocket = new TestSocket();
     var socketStream = new SocketSession(testSocket);
     testSocket.PutBytes(new byte[] {104, 101, 108, 108, 111});
     testSocket.PutBytes(new byte[] {32, 119,111,114,108,100});
     Assert.AreEqual("hello world", socketStream.Read(11));
 }