public void TestMpackCloseResponseWriteRead() { // Arrange var args = CloseResponse.Create(1000, 3000, 200, (int)SocketError.Closed); var response = Message.Create(null, null, null, args); var stream = new MemoryStream(); // Act response.Encode(stream, CodecId.Mpack); byte[] buf = Interop.MessageDecodeEncode(CodecId.Mpack, 1, stream.GetBuffer(), stream.Length, buffer, buffer.Length); var returned = Serializable.Decode <Message>(new MemoryStream(buf), CodecId.Mpack); // Assert Assert.IsTrue(response.Equals(returned)); }
public void TestMpackCloseResponseWriteRead() { // Arrange CloseResponse args = new CloseResponse(); args.ErrorCode = (Int32)SocketError.Closed; args.TimeOpenInMilliseconds = 1000; args.BytesSent = 200; args.BytesReceived = 1; Message response = new Message(null, null, null, args); MemoryStream stream = new MemoryStream(); // Act response.Encode(stream, CodecId.Mpack); byte[] buf = Interop.MessageDecodeEncode(CodecId.Mpack, 1, stream.GetBuffer(), stream.Length, buffer, buffer.Length); Message returned = Message.Decode(new MemoryStream(buf), CodecId.Mpack); // Assert Assert.IsTrue(response.Equals(returned)); }