コード例 #1
0
    public void ThreeMessages() {
      NestedMessage message1 = new NestedMessage.Builder { Bb = 5 }.Build();
      NestedMessage message2 = new NestedMessage.Builder { Bb = 1500 }.Build();
      NestedMessage message3 = new NestedMessage.Builder().Build();

      byte[] data;
      using (MemoryStream stream = new MemoryStream()) {
        MessageStreamWriter<NestedMessage> writer = new MessageStreamWriter<NestedMessage>(stream);
        writer.Write(message1);
        writer.Write(message2);
        writer.Write(message3);
        writer.Flush();
        data = stream.ToArray();
      }

      TestUtil.AssertEqualBytes(ThreeMessageData, data);
    }
コード例 #2
0
        public void ThreeMessages()
        {
            NestedMessage message1 = new NestedMessage.Builder {
                Bb = 5
            }.Build();
            NestedMessage message2 = new NestedMessage.Builder {
                Bb = 1500
            }.Build();
            NestedMessage message3 = new NestedMessage.Builder().Build();

            byte[] data;
            using (MemoryStream stream = new MemoryStream()) {
                MessageStreamWriter <NestedMessage> writer = new MessageStreamWriter <NestedMessage>(stream);
                writer.Write(message1);
                writer.Write(message2);
                writer.Write(message3);
                writer.Flush();
                data = stream.ToArray();
            }

            TestUtil.AssertEqualBytes(ThreeMessageData, data);
        }