1 #region Copyright notice and license 2 // Protocol Buffers - Google's data interchange format 3 // Copyright 2015 Google Inc. All rights reserved. 4 // 5 // Use of this source code is governed by a BSD-style 6 // license that can be found in the LICENSE file or at 7 // https://developers.google.com/open-source/licenses/bsd 8 #endregion 9 10 using NUnit.Framework; 11 12 namespace Google.Protobuf 13 { 14 internal static class CodedInputStreamExtensions 15 { AssertNextTag(this CodedInputStream input, uint expectedTag)16 public static void AssertNextTag(this CodedInputStream input, uint expectedTag) 17 { 18 uint tag = input.ReadTag(); 19 Assert.AreEqual(expectedTag, tag); 20 } 21 22 public static T ReadMessage<T>(this CodedInputStream stream, MessageParser<T> parser) 23 where T : IMessage<T> 24 { 25 var message = parser.CreateTemplate(); 26 stream.ReadMessage(message); 27 return message; 28 } 29 } 30 } 31