public void ExtensionReflectionSetters() { TestAllExtensions.Builder builder = TestAllExtensions.CreateBuilder(); extensionsReflectionTester.SetAllFieldsViaReflection(builder); TestAllExtensions message = builder.Build(); TestUtil.AssertAllExtensionsSet(message); }
public void ParseExtensions() { TestAllExtensions.Builder builder = TestAllExtensions.CreateBuilder(); TextFormat.Merge(AllExtensionsSetText, TestUtil.CreateExtensionRegistry(), builder); TestUtil.AssertAllExtensionsSet(builder.Build()); }
public void ExtensionAccessors() { TestAllExtensions.Builder builder = TestAllExtensions.CreateBuilder(); TestUtil.SetAllExtensions(builder); TestAllExtensions message = builder.Build(); TestUtil.AssertAllExtensionsSet(message); }
public void ParseExtensions() { // TestAllTypes and TestAllExtensions should have compatible wire formats, // so if we serealize a TestAllTypes then parse it as TestAllExtensions // it should work. TestAllTypes message = TestUtil.GetAllSet(); ByteString rawBytes = message.ToByteString(); ExtensionRegistry registry = ExtensionRegistry.CreateInstance(); TestUtil.RegisterAllExtensions(registry); registry = registry.AsReadOnly(); TestAllExtensions message2 = TestAllExtensions.ParseFrom(rawBytes, registry); TestUtil.AssertAllExtensionsSet(message2); }