Exemplo n.º 1
0
        public void SetUp ()
        {
            // Create a response object and get the binary representation of it
            var streamMessage = new StreamMessage ();

            var response1 = new Response ();
            response1.Time = 42;
            response1.Error = "Foo";

            var streamResponse1 = new StreamResponse (1263);
            streamResponse1.Response = response1;

            var response2 = new Response ();
            response2.Time = 123;
            response2.Error = "Bar";

            var streamResponse2 = new StreamResponse (3443);
            streamResponse2.Response = response2;

            streamMessage.Responses.Add (streamResponse1);
            streamMessage.Responses.Add (streamResponse2);

            expectedMessage = streamMessage;
            using (var stream = new MemoryStream ()) {
                expectedMessage.ToProtobufMessage ().WriteDelimitedTo (stream);
                messageBytes = stream.ToArray ();
            }
        }
Exemplo n.º 2
0
 public override void Write (StreamMessage value)
 {
     codedOutputStream.WriteMessage (value.ToProtobufMessage ());
     codedOutputStream.Flush ();
 }