Exemple #1
0
        public void SetUp()
        {
            // Create a response object and get the binary representation of it
            var streamUpdate = new StreamUpdate();

            var result1 = new ProcedureResult();

            result1.Error = new Error("Foo", string.Empty);

            var streamResult1 = new StreamResult();

            streamResult1.Id     = 1263;
            streamResult1.Result = result1;

            var result2 = new ProcedureResult();

            result2.Error = new Error("Bar", string.Empty);

            var streamResult2 = new StreamResult();

            streamResult2.Id     = 3443;
            streamResult2.Result = result2;

            streamUpdate.Results.Add(streamResult1);
            streamUpdate.Results.Add(streamResult2);

            expectedUpdate = streamUpdate;
            using (var stream = new MemoryStream()) {
                expectedUpdate.ToProtobufMessage().WriteDelimitedTo(stream);
                updateBytes = stream.ToArray();
            }
        }
Exemple #2
0
 public override void Write(StreamUpdate value)
 {
     using (var bufferStream = new MemoryStream()) {
         value.ToProtobufMessage().WriteTo(bufferStream);
         bufferStream.Flush();
         var payload = bufferStream.ToArray();
         var frame   = new Frame(OpCode.Binary, payload);
         Stream.Write(frame.Header.ToBytes());
         Stream.Write(frame.Payload);
     }
 }
Exemple #3
0
 public override void Write(StreamUpdate value)
 {
     codedOutputStream.WriteMessage(value.ToProtobufMessage());
     codedOutputStream.Flush();
 }