コード例 #1
0
 public void SimpleStringIsWritten()
 {
     var testSocket = new TestSocket();
     var socketStream = new SocketStream(testSocket);
     socketStream.Write("hello");
     Assert.AreEqual(new byte[] {104, 101, 108, 108, 111}, testSocket.GetBytes());
 }
コード例 #2
0
 public void StringIsWrittenWithLengthPrefix()
 {
     var testSocket = new TestSocket();
     var socketStream = new SocketStream(testSocket);
     socketStream.Write("h\u2019llo", "{0}:");
     Assert.AreEqual(new byte[] {55, 58, 104, 226, 128, 153, 108, 108, 111}, testSocket.GetBytes());
 }
コード例 #3
0
 public void SimpleStringIsRead()
 {
     var testSocket = new TestSocket();
     var socketStream = new SocketStream(testSocket);
     testSocket.PutBytes(new byte[] {104, 101, 108, 108, 111});
     Assert.AreEqual("hello", socketStream.ReadBytes(5));
 }
コード例 #4
0
 public void EncodedStringIsRead()
 {
     var testSocket = new TestSocket();
     var socketStream = new SocketStream(testSocket);
     testSocket.PutBytes(new byte[] {104, 226, 128, 153, 108, 108, 111});
     Assert.AreEqual("h\u2019llo", socketStream.ReadBytes(7));
 }
コード例 #5
0
 [Test] public void StringIsReadInMultipleParts() {
     var testSocket = new TestSocket();
     var socketStream = new SocketStream(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.ReadBytes(11));
 }
コード例 #6
0
ファイル: Messenger.cs プロジェクト: vaibhavsapre/fitsharp
 public Messenger(SocketModel socket)
 {
     this.socket = socket;
     stream = new SocketStream(socket);
     stream.Write("Slim -- V0.0\n");
 }
コード例 #7
0
ファイル: FitSocket.cs プロジェクト: GibSral/fitsharp
 public FitSocket(SocketModel socket, ProgressReporter reporter) {
     socketStream = new SocketStream(socket);
     this.reporter = reporter;
     this.socket = socket;
 }