Add test for parsing using coded input
This commit is contained in:
parent
ca123ec40e
commit
d36d84c77b
@ -376,5 +376,18 @@ namespace Google.Protobuf
|
||||
TestGroupExtension extendable_parsed = TestGroupExtension.Parser.WithExtensionRegistry(new ExtensionRegistry() { TestNestedExtension.Extensions.OptionalGroupExtension }).ParseFrom(bytes);
|
||||
Assert.AreEqual(message, extendable_parsed);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void RoundTrip_ParseUsingCodedInput()
|
||||
{
|
||||
var message = new TestAllExtensions();
|
||||
message.SetExtension(UnittestExtensions.OptionalBoolExtension, true);
|
||||
byte[] bytes = message.ToByteArray();
|
||||
using (CodedInputStream input = new CodedInputStream(bytes))
|
||||
{
|
||||
var parsed = TestAllExtensions.Parser.WithExtensionRegistry(new ExtensionRegistry() { UnittestExtensions.OptionalBoolExtension }).ParseFrom(input);
|
||||
Assert.AreEqual(message, parsed);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user