Ejemplo n.º 1
0
        public void ExtensionReflectionSetters()
        {
            TestAllExtensions.Builder builder = TestAllExtensions.CreateBuilder();
            extensionsReflectionTester.SetAllFieldsViaReflection(builder);
            TestAllExtensions message = builder.Build();

            TestUtil.AssertAllExtensionsSet(message);
        }
Ejemplo n.º 2
0
 public void ParseExtensions()
 {
     TestAllExtensions.Builder builder = TestAllExtensions.CreateBuilder();
     TextFormat.Merge(AllExtensionsSetText,
                      TestUtil.CreateExtensionRegistry(),
                      builder);
     TestUtil.AssertAllExtensionsSet(builder.Build());
 }
Ejemplo n.º 3
0
        public void ExtensionAccessors()
        {
            TestAllExtensions.Builder builder = TestAllExtensions.CreateBuilder();
            TestUtil.SetAllExtensions(builder);
            TestAllExtensions message = builder.Build();

            TestUtil.AssertAllExtensionsSet(message);
        }
Ejemplo n.º 4
0
        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);
        }