Exemplo n.º 1
0
        public void GetSingle()
        {
            var extensionValue = new TestAllTypes.Types.NestedMessage()
            {
                Bb = 42
            };
            var untypedExtension    = new Extension <TestAllExtensions, object>(OptionalNestedMessageExtension.FieldNumber, codec: null);
            var wrongTypedExtension = new Extension <TestAllExtensions, TestAllTypes>(OptionalNestedMessageExtension.FieldNumber, codec: null);

            var message = new TestAllExtensions();

            var value1 = message.GetExtension(untypedExtension);

            Assert.IsNull(value1);

            message.SetExtension(OptionalNestedMessageExtension, extensionValue);
            var value2 = message.GetExtension(untypedExtension);

            Assert.IsNotNull(value2);

            var valueBytes  = ((IMessage)value2).ToByteArray();
            var parsedValue = TestProtos.Proto2.TestAllTypes.Types.NestedMessage.Parser.ParseFrom(valueBytes);

            Assert.AreEqual(extensionValue, parsedValue);

            var ex = Assert.Throws <InvalidOperationException>(() => message.GetExtension(wrongTypedExtension));

            var expectedMessage = "The stored extension value has a type of 'Google.Protobuf.TestProtos.Proto2.TestAllTypes+Types+NestedMessage, Google.Protobuf.Test.TestProtos, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604'. " +
                                  "This a different from the requested type of 'Google.Protobuf.TestProtos.Proto2.TestAllTypes, Google.Protobuf.Test.TestProtos, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604'.";

            Assert.AreEqual(expectedMessage, ex.Message);
        }
        public void ParseUnknownEnumValue()
        {
            FieldDescriptor singularField =
                TestAllTypes.Descriptor.FindDescriptor <FieldDescriptor>("optional_nested_enum");
            FieldDescriptor repeatedField =
                TestAllTypes.Descriptor.FindDescriptor <FieldDescriptor>("repeated_nested_enum");

            Assert.IsNotNull(singularField);
            Assert.IsNotNull(repeatedField);

            ByteString data =
                UnknownFieldSet.CreateBuilder()
                .AddField(singularField.FieldNumber,
                          UnknownField.CreateBuilder()
                          .AddVarint((int)TestAllTypes.Types.NestedEnum.BAR)
                          .AddVarint(5)         // not valid
                          .Build())
                .AddField(repeatedField.FieldNumber,
                          UnknownField.CreateBuilder()
                          .AddVarint((int)TestAllTypes.Types.NestedEnum.FOO)
                          .AddVarint(4)         // not valid
                          .AddVarint((int)TestAllTypes.Types.NestedEnum.BAZ)
                          .AddVarint(6)         // not valid
                          .Build())
                .Build()
                .ToByteString();

            {
                TestAllTypes message = TestAllTypes.ParseFrom(data);
                Assert.AreEqual(TestAllTypes.Types.NestedEnum.BAR,
                                message.OptionalNestedEnum);
                TestUtil.AssertEqual(new[] { TestAllTypes.Types.NestedEnum.FOO, TestAllTypes.Types.NestedEnum.BAZ },
                                     message.RepeatedNestedEnumList);
                TestUtil.AssertEqual(new[] { 5UL }, message.UnknownFields[singularField.FieldNumber].VarintList);
                TestUtil.AssertEqual(new[] { 4UL, 6UL }, message.UnknownFields[repeatedField.FieldNumber].VarintList);
            }

            {
                TestAllExtensions message =
                    TestAllExtensions.ParseFrom(data, TestUtil.CreateExtensionRegistry());
                Assert.AreEqual(TestAllTypes.Types.NestedEnum.BAR,
                                message.GetExtension(UnitTestProtoFile.OptionalNestedEnumExtension));
                TestUtil.AssertEqual(new[] { TestAllTypes.Types.NestedEnum.FOO, TestAllTypes.Types.NestedEnum.BAZ },
                                     message.GetExtension(UnitTestProtoFile.RepeatedNestedEnumExtension));
                TestUtil.AssertEqual(new[] { 5UL }, message.UnknownFields[singularField.FieldNumber].VarintList);
                TestUtil.AssertEqual(new[] { 4UL, 6UL }, message.UnknownFields[repeatedField.FieldNumber].VarintList);
            }
        }
Exemplo n.º 3
0
        public void ExtensionMergeFrom()
        {
            TestAllExtensions original = TestAllExtensions.CreateBuilder()
                                         .SetExtension(UnitTestProtoFile.OptionalInt32Extension, 1).Build();
            TestAllExtensions merged =
                TestAllExtensions.CreateBuilder().MergeFrom(original).Build();

            Assert.IsTrue((merged.HasExtension(UnitTestProtoFile.OptionalInt32Extension)));
            Assert.AreEqual(1, (int)merged.GetExtension(UnitTestProtoFile.OptionalInt32Extension));
        }
Exemplo n.º 4
0
        public void RequiredFieldsInExtensions()
        {
            var message = new TestAllExtensions();

            Assert.True(message.IsInitialized());

            message.SetExtension(TestRequired.Extensions.Single, new TestRequired());

            Assert.False(message.IsInitialized());

            var extensionMessage = message.GetExtension(TestRequired.Extensions.Single);

            extensionMessage.A = 1;
            extensionMessage.B = 2;
            extensionMessage.C = 3;

            Assert.True(message.IsInitialized());

            message.GetOrInitializeExtension(TestRequired.Extensions.Multi);

            Assert.True(message.IsInitialized());

            message.GetExtension(TestRequired.Extensions.Multi).Add(new TestRequired());

            Assert.False(message.IsInitialized());

            extensionMessage   = message.GetExtension(TestRequired.Extensions.Multi)[0];
            extensionMessage.A = 1;
            extensionMessage.B = 2;
            extensionMessage.C = 3;

            Assert.True(message.IsInitialized());

            message.SetExtension(UnittestExtensions.OptionalBoolExtension, true);

            Assert.True(message.IsInitialized());

            message.GetOrInitializeExtension(UnittestExtensions.RepeatedBoolExtension).Add(true);

            Assert.True(message.IsInitialized());
        }
Exemplo n.º 5
0
        public void TestDefaultValueRoundTrip()
        {
            var message = new TestAllExtensions();

            message.SetExtension(OptionalBoolExtension, false);
            Assert.IsFalse(message.GetExtension(OptionalBoolExtension));
            Assert.IsTrue(message.HasExtension(OptionalBoolExtension));

            var bytes    = message.ToByteArray();
            var registry = new ExtensionRegistry {
                OptionalBoolExtension
            };
            var parsed = TestAllExtensions.Parser.WithExtensionRegistry(registry).ParseFrom(bytes);

            Assert.IsFalse(parsed.GetExtension(OptionalBoolExtension));
            Assert.IsTrue(parsed.HasExtension(OptionalBoolExtension));
        }
Exemplo n.º 6
0
        public void ExtensionWriterTest()
        {
            TestAllExtensions.Builder builder = TestAllExtensions.CreateBuilder()
                                                .SetExtension(Unittest.DefaultBoolExtension, true)
                                                .SetExtension(Unittest.DefaultBytesExtension, ByteString.CopyFromUtf8("123"))
                                                .SetExtension(Unittest.DefaultCordExtension, "123")
                                                .SetExtension(Unittest.DefaultDoubleExtension, 123)
                                                .SetExtension(Unittest.DefaultFixed32Extension, 123u)
                                                .SetExtension(Unittest.DefaultFixed64Extension, 123u)
                                                .SetExtension(Unittest.DefaultFloatExtension, 123)
                                                .SetExtension(Unittest.DefaultForeignEnumExtension, ForeignEnum.FOREIGN_BAZ)
                                                .SetExtension(Unittest.DefaultImportEnumExtension, ImportEnum.IMPORT_BAZ)
                                                .SetExtension(Unittest.DefaultInt32Extension, 123)
                                                .SetExtension(Unittest.DefaultInt64Extension, 123)
                                                .SetExtension(Unittest.DefaultNestedEnumExtension, TestAllTypes.Types.NestedEnum.FOO)
                                                .SetExtension(Unittest.DefaultSfixed32Extension, 123)
                                                .SetExtension(Unittest.DefaultSfixed64Extension, 123)
                                                .SetExtension(Unittest.DefaultSint32Extension, 123)
                                                .SetExtension(Unittest.DefaultSint64Extension, 123)
                                                .SetExtension(Unittest.DefaultStringExtension, "123")
                                                .SetExtension(Unittest.DefaultStringPieceExtension, "123")
                                                .SetExtension(Unittest.DefaultUint32Extension, 123u)
                                                .SetExtension(Unittest.DefaultUint64Extension, 123u)
                                                //Optional
                                                .SetExtension(Unittest.OptionalBoolExtension, true)
                                                .SetExtension(Unittest.OptionalBytesExtension, ByteString.CopyFromUtf8("123"))
                                                .SetExtension(Unittest.OptionalCordExtension, "123")
                                                .SetExtension(Unittest.OptionalDoubleExtension, 123)
                                                .SetExtension(Unittest.OptionalFixed32Extension, 123u)
                                                .SetExtension(Unittest.OptionalFixed64Extension, 123u)
                                                .SetExtension(Unittest.OptionalFloatExtension, 123)
                                                .SetExtension(Unittest.OptionalForeignEnumExtension, ForeignEnum.FOREIGN_BAZ)
                                                .SetExtension(Unittest.OptionalImportEnumExtension, ImportEnum.IMPORT_BAZ)
                                                .SetExtension(Unittest.OptionalInt32Extension, 123)
                                                .SetExtension(Unittest.OptionalInt64Extension, 123)
                                                .SetExtension(Unittest.OptionalNestedEnumExtension, TestAllTypes.Types.NestedEnum.FOO)
                                                .SetExtension(Unittest.OptionalSfixed32Extension, 123)
                                                .SetExtension(Unittest.OptionalSfixed64Extension, 123)
                                                .SetExtension(Unittest.OptionalSint32Extension, 123)
                                                .SetExtension(Unittest.OptionalSint64Extension, 123)
                                                .SetExtension(Unittest.OptionalStringExtension, "123")
                                                .SetExtension(Unittest.OptionalStringPieceExtension, "123")
                                                .SetExtension(Unittest.OptionalUint32Extension, 123u)
                                                .SetExtension(Unittest.OptionalUint64Extension, 123u)
                                                //Repeated
                                                .AddExtension(Unittest.RepeatedBoolExtension, true)
                                                .AddExtension(Unittest.RepeatedBytesExtension, ByteString.CopyFromUtf8("123"))
                                                .AddExtension(Unittest.RepeatedCordExtension, "123")
                                                .AddExtension(Unittest.RepeatedDoubleExtension, 123)
                                                .AddExtension(Unittest.RepeatedFixed32Extension, 123u)
                                                .AddExtension(Unittest.RepeatedFixed64Extension, 123u)
                                                .AddExtension(Unittest.RepeatedFloatExtension, 123)
                                                .AddExtension(Unittest.RepeatedForeignEnumExtension, ForeignEnum.FOREIGN_BAZ)
                                                .AddExtension(Unittest.RepeatedImportEnumExtension, ImportEnum.IMPORT_BAZ)
                                                .AddExtension(Unittest.RepeatedInt32Extension, 123)
                                                .AddExtension(Unittest.RepeatedInt64Extension, 123)
                                                .AddExtension(Unittest.RepeatedNestedEnumExtension, TestAllTypes.Types.NestedEnum.FOO)
                                                .AddExtension(Unittest.RepeatedSfixed32Extension, 123)
                                                .AddExtension(Unittest.RepeatedSfixed64Extension, 123)
                                                .AddExtension(Unittest.RepeatedSint32Extension, 123)
                                                .AddExtension(Unittest.RepeatedSint64Extension, 123)
                                                .AddExtension(Unittest.RepeatedStringExtension, "123")
                                                .AddExtension(Unittest.RepeatedStringPieceExtension, "123")
                                                .AddExtension(Unittest.RepeatedUint32Extension, 123u)
                                                .AddExtension(Unittest.RepeatedUint64Extension, 123u)
            ;
            TestAllExtensions msg = builder.Build();

            ExtensionRegistry registry = ExtensionRegistry.CreateInstance();

            Unittest.RegisterAllExtensions(registry);

            TestAllExtensions.Builder copyBuilder = TestAllExtensions.CreateBuilder().MergeFrom(msg.ToByteArray(),
                                                                                                registry);
            TestAllExtensions copy = copyBuilder.Build();

            Assert.AreEqual(msg.ToByteArray(), copy.ToByteArray());

            Assert.AreEqual(true, copy.GetExtension(Unittest.DefaultBoolExtension));
            Assert.AreEqual(ByteString.CopyFromUtf8("123"), copy.GetExtension(Unittest.DefaultBytesExtension));
            Assert.AreEqual("123", copy.GetExtension(Unittest.DefaultCordExtension));
            Assert.AreEqual(123, copy.GetExtension(Unittest.DefaultDoubleExtension));
            Assert.AreEqual(123u, copy.GetExtension(Unittest.DefaultFixed32Extension));
            Assert.AreEqual(123u, copy.GetExtension(Unittest.DefaultFixed64Extension));
            Assert.AreEqual(123, copy.GetExtension(Unittest.DefaultFloatExtension));
            Assert.AreEqual(ForeignEnum.FOREIGN_BAZ, copy.GetExtension(Unittest.DefaultForeignEnumExtension));
            Assert.AreEqual(ImportEnum.IMPORT_BAZ, copy.GetExtension(Unittest.DefaultImportEnumExtension));
            Assert.AreEqual(123, copy.GetExtension(Unittest.DefaultInt32Extension));
            Assert.AreEqual(123, copy.GetExtension(Unittest.DefaultInt64Extension));
            Assert.AreEqual(TestAllTypes.Types.NestedEnum.FOO,
                            copy.GetExtension(Unittest.DefaultNestedEnumExtension));
            Assert.AreEqual(123, copy.GetExtension(Unittest.DefaultSfixed32Extension));
            Assert.AreEqual(123, copy.GetExtension(Unittest.DefaultSfixed64Extension));
            Assert.AreEqual(123, copy.GetExtension(Unittest.DefaultSint32Extension));
            Assert.AreEqual(123, copy.GetExtension(Unittest.DefaultSint64Extension));
            Assert.AreEqual("123", copy.GetExtension(Unittest.DefaultStringExtension));
            Assert.AreEqual("123", copy.GetExtension(Unittest.DefaultStringPieceExtension));
            Assert.AreEqual(123u, copy.GetExtension(Unittest.DefaultUint32Extension));
            Assert.AreEqual(123u, copy.GetExtension(Unittest.DefaultUint64Extension));

            Assert.AreEqual(true, copy.GetExtension(Unittest.OptionalBoolExtension));
            Assert.AreEqual(ByteString.CopyFromUtf8("123"), copy.GetExtension(Unittest.OptionalBytesExtension));
            Assert.AreEqual("123", copy.GetExtension(Unittest.OptionalCordExtension));
            Assert.AreEqual(123, copy.GetExtension(Unittest.OptionalDoubleExtension));
            Assert.AreEqual(123u, copy.GetExtension(Unittest.OptionalFixed32Extension));
            Assert.AreEqual(123u, copy.GetExtension(Unittest.OptionalFixed64Extension));
            Assert.AreEqual(123, copy.GetExtension(Unittest.OptionalFloatExtension));
            Assert.AreEqual(ForeignEnum.FOREIGN_BAZ, copy.GetExtension(Unittest.OptionalForeignEnumExtension));
            Assert.AreEqual(ImportEnum.IMPORT_BAZ, copy.GetExtension(Unittest.OptionalImportEnumExtension));
            Assert.AreEqual(123, copy.GetExtension(Unittest.OptionalInt32Extension));
            Assert.AreEqual(123, copy.GetExtension(Unittest.OptionalInt64Extension));
            Assert.AreEqual(TestAllTypes.Types.NestedEnum.FOO,
                            copy.GetExtension(Unittest.OptionalNestedEnumExtension));
            Assert.AreEqual(123, copy.GetExtension(Unittest.OptionalSfixed32Extension));
            Assert.AreEqual(123, copy.GetExtension(Unittest.OptionalSfixed64Extension));
            Assert.AreEqual(123, copy.GetExtension(Unittest.OptionalSint32Extension));
            Assert.AreEqual(123, copy.GetExtension(Unittest.OptionalSint64Extension));
            Assert.AreEqual("123", copy.GetExtension(Unittest.OptionalStringExtension));
            Assert.AreEqual("123", copy.GetExtension(Unittest.OptionalStringPieceExtension));
            Assert.AreEqual(123u, copy.GetExtension(Unittest.OptionalUint32Extension));
            Assert.AreEqual(123u, copy.GetExtension(Unittest.OptionalUint64Extension));

            Assert.AreEqual(true, copy.GetExtension(Unittest.RepeatedBoolExtension, 0));
            Assert.AreEqual(ByteString.CopyFromUtf8("123"),
                            copy.GetExtension(Unittest.RepeatedBytesExtension, 0));
            Assert.AreEqual("123", copy.GetExtension(Unittest.RepeatedCordExtension, 0));
            Assert.AreEqual(123, copy.GetExtension(Unittest.RepeatedDoubleExtension, 0));
            Assert.AreEqual(123u, copy.GetExtension(Unittest.RepeatedFixed32Extension, 0));
            Assert.AreEqual(123u, copy.GetExtension(Unittest.RepeatedFixed64Extension, 0));
            Assert.AreEqual(123, copy.GetExtension(Unittest.RepeatedFloatExtension, 0));
            Assert.AreEqual(ForeignEnum.FOREIGN_BAZ,
                            copy.GetExtension(Unittest.RepeatedForeignEnumExtension, 0));
            Assert.AreEqual(ImportEnum.IMPORT_BAZ, copy.GetExtension(Unittest.RepeatedImportEnumExtension, 0));
            Assert.AreEqual(123, copy.GetExtension(Unittest.RepeatedInt32Extension, 0));
            Assert.AreEqual(123, copy.GetExtension(Unittest.RepeatedInt64Extension, 0));
            Assert.AreEqual(TestAllTypes.Types.NestedEnum.FOO,
                            copy.GetExtension(Unittest.RepeatedNestedEnumExtension, 0));
            Assert.AreEqual(123, copy.GetExtension(Unittest.RepeatedSfixed32Extension, 0));
            Assert.AreEqual(123, copy.GetExtension(Unittest.RepeatedSfixed64Extension, 0));
            Assert.AreEqual(123, copy.GetExtension(Unittest.RepeatedSint32Extension, 0));
            Assert.AreEqual(123, copy.GetExtension(Unittest.RepeatedSint64Extension, 0));
            Assert.AreEqual("123", copy.GetExtension(Unittest.RepeatedStringExtension, 0));
            Assert.AreEqual("123", copy.GetExtension(Unittest.RepeatedStringPieceExtension, 0));
            Assert.AreEqual(123u, copy.GetExtension(Unittest.RepeatedUint32Extension, 0));
            Assert.AreEqual(123u, copy.GetExtension(Unittest.RepeatedUint64Extension, 0));
        }
Exemplo n.º 7
0
        public void DefaultExtensionValues()
        {
            var message = new TestAllExtensions();

            Assert.AreEqual(false, message.GetExtension(OptionalBoolExtension));
            Assert.AreEqual(ByteString.Empty, message.GetExtension(OptionalBytesExtension));
            Assert.AreEqual(0.0, message.GetExtension(OptionalDoubleExtension));
            Assert.AreEqual(0, message.GetExtension(OptionalFixed32Extension));
            Assert.AreEqual(0L, message.GetExtension(OptionalFixed64Extension));
            Assert.AreEqual(0.0f, message.GetExtension(OptionalFloatExtension));
            Assert.AreEqual(ForeignEnum.ForeignFoo, message.GetExtension(OptionalForeignEnumExtension));
            Assert.IsNull(message.GetExtension(OptionalForeignMessageExtension));
            Assert.AreEqual(ImportEnum.ImportFoo, message.GetExtension(OptionalImportEnumExtension));
            Assert.IsNull(message.GetExtension(OptionalImportMessageExtension));
            Assert.AreEqual(0, message.GetExtension(OptionalInt32Extension));
            Assert.AreEqual(0L, message.GetExtension(OptionalInt64Extension));
            Assert.AreEqual(Proto2.TestAllTypes.Types.NestedEnum.Foo, message.GetExtension(OptionalNestedEnumExtension));
            Assert.IsNull(message.GetExtension(OptionalNestedMessageExtension));
            Assert.IsNull(message.GetExtension(OptionalPublicImportMessageExtension));
            Assert.AreEqual(0, message.GetExtension(OptionalSfixed32Extension));
            Assert.AreEqual(0L, message.GetExtension(OptionalSfixed64Extension));
            Assert.AreEqual(0, message.GetExtension(OptionalSint32Extension));
            Assert.AreEqual(0L, message.GetExtension(OptionalSint64Extension));
            Assert.AreEqual("", message.GetExtension(OptionalStringExtension));
            Assert.AreEqual(0U, message.GetExtension(OptionalUint32Extension));
            Assert.AreEqual(0UL, message.GetExtension(OptionalUint64Extension));

            // Repeated fields
            Assert.IsNull(message.GetExtension(RepeatedBoolExtension));
            Assert.IsNull(message.GetExtension(RepeatedBytesExtension));
            Assert.IsNull(message.GetExtension(RepeatedDoubleExtension));
            Assert.IsNull(message.GetExtension(RepeatedFixed32Extension));
            Assert.IsNull(message.GetExtension(RepeatedFixed64Extension));
            Assert.IsNull(message.GetExtension(RepeatedFloatExtension));
            Assert.IsNull(message.GetExtension(RepeatedForeignEnumExtension));
            Assert.IsNull(message.GetExtension(RepeatedForeignMessageExtension));
            Assert.IsNull(message.GetExtension(RepeatedImportEnumExtension));
            Assert.IsNull(message.GetExtension(RepeatedImportMessageExtension));
            Assert.IsNull(message.GetExtension(RepeatedNestedEnumExtension));
            Assert.IsNull(message.GetExtension(RepeatedNestedMessageExtension));
            Assert.IsNull(message.GetExtension(RepeatedSfixed32Extension));
            Assert.IsNull(message.GetExtension(RepeatedSfixed64Extension));
            Assert.IsNull(message.GetExtension(RepeatedSint32Extension));
            Assert.IsNull(message.GetExtension(RepeatedSint64Extension));
            Assert.IsNull(message.GetExtension(RepeatedStringExtension));
            Assert.IsNull(message.GetExtension(RepeatedUint32Extension));
            Assert.IsNull(message.GetExtension(RepeatedUint64Extension));

            // Oneof fields
            Assert.AreEqual(0, message.GetExtension(OneofUint32Extension));
            Assert.AreEqual("", message.GetExtension(OneofStringExtension));
            Assert.AreEqual(ByteString.Empty, message.GetExtension(OneofBytesExtension));
            Assert.IsNull(message.GetExtension(OneofNestedMessageExtension));

            Assert.AreEqual(true, message.GetExtension(DefaultBoolExtension));
            Assert.AreEqual(ByteString.CopyFromUtf8("world"), message.GetExtension(DefaultBytesExtension));
            Assert.AreEqual("123", message.GetExtension(DefaultCordExtension));
            Assert.AreEqual(52e3, message.GetExtension(DefaultDoubleExtension));
            Assert.AreEqual(47, message.GetExtension(DefaultFixed32Extension));
            Assert.AreEqual(48, message.GetExtension(DefaultFixed64Extension));
            Assert.AreEqual(51.5, message.GetExtension(DefaultFloatExtension));
            Assert.AreEqual(ForeignEnum.ForeignBar, message.GetExtension(DefaultForeignEnumExtension));
            Assert.AreEqual(ImportEnum.ImportBar, message.GetExtension(DefaultImportEnumExtension));
            Assert.AreEqual(41, message.GetExtension(DefaultInt32Extension));
            Assert.AreEqual(42, message.GetExtension(DefaultInt64Extension));
            Assert.AreEqual(Proto2.TestAllTypes.Types.NestedEnum.Bar, message.GetExtension(DefaultNestedEnumExtension));
            Assert.AreEqual(49, message.GetExtension(DefaultSfixed32Extension));
            Assert.AreEqual(-50, message.GetExtension(DefaultSfixed64Extension));
            Assert.AreEqual(-45, message.GetExtension(DefaultSint32Extension));
            Assert.AreEqual(46, message.GetExtension(DefaultSint64Extension));
            Assert.AreEqual("hello", message.GetExtension(DefaultStringExtension));
            Assert.AreEqual("abc", message.GetExtension(DefaultStringPieceExtension));
            Assert.AreEqual(43, message.GetExtension(DefaultUint32Extension));
            Assert.AreEqual(44, message.GetExtension(DefaultUint64Extension));

            Assert.False(message.HasExtension(DefaultBoolExtension));
            Assert.False(message.HasExtension(DefaultBytesExtension));
            Assert.False(message.HasExtension(DefaultCordExtension));
            Assert.False(message.HasExtension(DefaultDoubleExtension));
            Assert.False(message.HasExtension(DefaultFixed32Extension));
            Assert.False(message.HasExtension(DefaultFixed64Extension));
            Assert.False(message.HasExtension(DefaultFloatExtension));
            Assert.False(message.HasExtension(DefaultForeignEnumExtension));
            Assert.False(message.HasExtension(DefaultImportEnumExtension));
            Assert.False(message.HasExtension(DefaultInt32Extension));
            Assert.False(message.HasExtension(DefaultInt64Extension));
            Assert.False(message.HasExtension(DefaultNestedEnumExtension));
            Assert.False(message.HasExtension(DefaultSfixed32Extension));
            Assert.False(message.HasExtension(DefaultSfixed64Extension));
            Assert.False(message.HasExtension(DefaultSint32Extension));
            Assert.False(message.HasExtension(DefaultSint64Extension));
            Assert.False(message.HasExtension(DefaultStringExtension));
            Assert.False(message.HasExtension(DefaultStringPieceExtension));
            Assert.False(message.HasExtension(DefaultUint32Extension));
            Assert.False(message.HasExtension(DefaultUint64Extension));
        }