Commit 08c84b90 authored by csharptest's avatar csharptest Committed by rogerk

Unit test correction for types that were moved to different proto files

parent af112a9f
......@@ -133,6 +133,7 @@ namespace Google.ProtocolBuffers
byte[] bytes = TestUtil.GetPackedSet().ToByteArray();
ExtensionRegistry registry = ExtensionRegistry.CreateInstance();
UnitTestProtoFile.RegisterAllExtensions(registry);
UnitTestExtrasProtoFile.RegisterAllExtensions(registry);
TestUnpackedExtensions message = TestUnpackedExtensions.ParseFrom(bytes, registry);
TestUtil.AssertUnpackedExtensionsSet(message);
}
......
......@@ -88,6 +88,7 @@
</Compile>
<Compile Include="Compatibility\TextCompatibilityTests.cs" />
<Compile Include="Compatibility\XmlCompatibilityTests.cs" />
<Compile Include="TestProtos\UnitTestExtrasProtoFile.cs" />
<Compile Include="TestRpcForMimeTypes.cs" />
<Compile Include="TestReaderForUrlEncoded.cs" />
<Compile Include="CSharpOptionsTest.cs" />
......
......@@ -1690,49 +1690,49 @@ namespace Google.ProtocolBuffers
public static void AssertUnpackedExtensionsSet(TestUnpackedExtensions message)
{
Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.UnpackedInt32Extension));
Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.UnpackedInt64Extension));
Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.UnpackedUint32Extension));
Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.UnpackedUint64Extension));
Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.UnpackedSint32Extension));
Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.UnpackedSint64Extension));
Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.UnpackedFixed32Extension));
Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.UnpackedFixed64Extension));
Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.UnpackedSfixed32Extension));
Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.UnpackedSfixed64Extension));
Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.UnpackedFloatExtension));
Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.UnpackedDoubleExtension));
Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.UnpackedBoolExtension));
Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.UnpackedEnumExtension));
Assert.AreEqual(601, message.GetExtension(UnitTestProtoFile.UnpackedInt32Extension, 0));
Assert.AreEqual(602L, message.GetExtension(UnitTestProtoFile.UnpackedInt64Extension, 0));
Assert.AreEqual(603, message.GetExtension(UnitTestProtoFile.UnpackedUint32Extension, 0));
Assert.AreEqual(604L, message.GetExtension(UnitTestProtoFile.UnpackedUint64Extension, 0));
Assert.AreEqual(605, message.GetExtension(UnitTestProtoFile.UnpackedSint32Extension, 0));
Assert.AreEqual(606L, message.GetExtension(UnitTestProtoFile.UnpackedSint64Extension, 0));
Assert.AreEqual(607, message.GetExtension(UnitTestProtoFile.UnpackedFixed32Extension, 0));
Assert.AreEqual(608L, message.GetExtension(UnitTestProtoFile.UnpackedFixed64Extension, 0));
Assert.AreEqual(609, message.GetExtension(UnitTestProtoFile.UnpackedSfixed32Extension, 0));
Assert.AreEqual(610L, message.GetExtension(UnitTestProtoFile.UnpackedSfixed64Extension, 0));
Assert.AreEqual(611F, message.GetExtension(UnitTestProtoFile.UnpackedFloatExtension, 0));
Assert.AreEqual(612D, message.GetExtension(UnitTestProtoFile.UnpackedDoubleExtension, 0));
Assert.AreEqual(true, message.GetExtension(UnitTestProtoFile.UnpackedBoolExtension, 0));
Assert.AreEqual(ForeignEnum.FOREIGN_BAR,
message.GetExtension(UnitTestProtoFile.UnpackedEnumExtension, 0));
Assert.AreEqual(701, message.GetExtension(UnitTestProtoFile.UnpackedInt32Extension, 1));
Assert.AreEqual(702L, message.GetExtension(UnitTestProtoFile.UnpackedInt64Extension, 1));
Assert.AreEqual(703, message.GetExtension(UnitTestProtoFile.UnpackedUint32Extension, 1));
Assert.AreEqual(704L, message.GetExtension(UnitTestProtoFile.UnpackedUint64Extension, 1));
Assert.AreEqual(705, message.GetExtension(UnitTestProtoFile.UnpackedSint32Extension, 1));
Assert.AreEqual(706L, message.GetExtension(UnitTestProtoFile.UnpackedSint64Extension, 1));
Assert.AreEqual(707, message.GetExtension(UnitTestProtoFile.UnpackedFixed32Extension, 1));
Assert.AreEqual(708L, message.GetExtension(UnitTestProtoFile.UnpackedFixed64Extension, 1));
Assert.AreEqual(709, message.GetExtension(UnitTestProtoFile.UnpackedSfixed32Extension, 1));
Assert.AreEqual(710L, message.GetExtension(UnitTestProtoFile.UnpackedSfixed64Extension, 1));
Assert.AreEqual(711F, message.GetExtension(UnitTestProtoFile.UnpackedFloatExtension, 1));
Assert.AreEqual(712D, message.GetExtension(UnitTestProtoFile.UnpackedDoubleExtension, 1));
Assert.AreEqual(false, message.GetExtension(UnitTestProtoFile.UnpackedBoolExtension, 1));
Assert.AreEqual(ForeignEnum.FOREIGN_BAZ, message.GetExtension(UnitTestProtoFile.UnpackedEnumExtension, 1));
Assert.AreEqual(2, message.GetExtensionCount(UnitTestExtrasProtoFile.UnpackedInt32Extension));
Assert.AreEqual(2, message.GetExtensionCount(UnitTestExtrasProtoFile.UnpackedInt64Extension));
Assert.AreEqual(2, message.GetExtensionCount(UnitTestExtrasProtoFile.UnpackedUint32Extension));
Assert.AreEqual(2, message.GetExtensionCount(UnitTestExtrasProtoFile.UnpackedUint64Extension));
Assert.AreEqual(2, message.GetExtensionCount(UnitTestExtrasProtoFile.UnpackedSint32Extension));
Assert.AreEqual(2, message.GetExtensionCount(UnitTestExtrasProtoFile.UnpackedSint64Extension));
Assert.AreEqual(2, message.GetExtensionCount(UnitTestExtrasProtoFile.UnpackedFixed32Extension));
Assert.AreEqual(2, message.GetExtensionCount(UnitTestExtrasProtoFile.UnpackedFixed64Extension));
Assert.AreEqual(2, message.GetExtensionCount(UnitTestExtrasProtoFile.UnpackedSfixed32Extension));
Assert.AreEqual(2, message.GetExtensionCount(UnitTestExtrasProtoFile.UnpackedSfixed64Extension));
Assert.AreEqual(2, message.GetExtensionCount(UnitTestExtrasProtoFile.UnpackedFloatExtension));
Assert.AreEqual(2, message.GetExtensionCount(UnitTestExtrasProtoFile.UnpackedDoubleExtension));
Assert.AreEqual(2, message.GetExtensionCount(UnitTestExtrasProtoFile.UnpackedBoolExtension));
Assert.AreEqual(2, message.GetExtensionCount(UnitTestExtrasProtoFile.UnpackedEnumExtension));
Assert.AreEqual(601, message.GetExtension(UnitTestExtrasProtoFile.UnpackedInt32Extension, 0));
Assert.AreEqual(602L, message.GetExtension(UnitTestExtrasProtoFile.UnpackedInt64Extension, 0));
Assert.AreEqual(603, message.GetExtension(UnitTestExtrasProtoFile.UnpackedUint32Extension, 0));
Assert.AreEqual(604L, message.GetExtension(UnitTestExtrasProtoFile.UnpackedUint64Extension, 0));
Assert.AreEqual(605, message.GetExtension(UnitTestExtrasProtoFile.UnpackedSint32Extension, 0));
Assert.AreEqual(606L, message.GetExtension(UnitTestExtrasProtoFile.UnpackedSint64Extension, 0));
Assert.AreEqual(607, message.GetExtension(UnitTestExtrasProtoFile.UnpackedFixed32Extension, 0));
Assert.AreEqual(608L, message.GetExtension(UnitTestExtrasProtoFile.UnpackedFixed64Extension, 0));
Assert.AreEqual(609, message.GetExtension(UnitTestExtrasProtoFile.UnpackedSfixed32Extension, 0));
Assert.AreEqual(610L, message.GetExtension(UnitTestExtrasProtoFile.UnpackedSfixed64Extension, 0));
Assert.AreEqual(611F, message.GetExtension(UnitTestExtrasProtoFile.UnpackedFloatExtension, 0));
Assert.AreEqual(612D, message.GetExtension(UnitTestExtrasProtoFile.UnpackedDoubleExtension, 0));
Assert.AreEqual(true, message.GetExtension(UnitTestExtrasProtoFile.UnpackedBoolExtension, 0));
Assert.AreEqual(UnpackedExtensionsForeignEnum.FOREIGN_BAR,
message.GetExtension(UnitTestExtrasProtoFile.UnpackedEnumExtension, 0));
Assert.AreEqual(701, message.GetExtension(UnitTestExtrasProtoFile.UnpackedInt32Extension, 1));
Assert.AreEqual(702L, message.GetExtension(UnitTestExtrasProtoFile.UnpackedInt64Extension, 1));
Assert.AreEqual(703, message.GetExtension(UnitTestExtrasProtoFile.UnpackedUint32Extension, 1));
Assert.AreEqual(704L, message.GetExtension(UnitTestExtrasProtoFile.UnpackedUint64Extension, 1));
Assert.AreEqual(705, message.GetExtension(UnitTestExtrasProtoFile.UnpackedSint32Extension, 1));
Assert.AreEqual(706L, message.GetExtension(UnitTestExtrasProtoFile.UnpackedSint64Extension, 1));
Assert.AreEqual(707, message.GetExtension(UnitTestExtrasProtoFile.UnpackedFixed32Extension, 1));
Assert.AreEqual(708L, message.GetExtension(UnitTestExtrasProtoFile.UnpackedFixed64Extension, 1));
Assert.AreEqual(709, message.GetExtension(UnitTestExtrasProtoFile.UnpackedSfixed32Extension, 1));
Assert.AreEqual(710L, message.GetExtension(UnitTestExtrasProtoFile.UnpackedSfixed64Extension, 1));
Assert.AreEqual(711F, message.GetExtension(UnitTestExtrasProtoFile.UnpackedFloatExtension, 1));
Assert.AreEqual(712D, message.GetExtension(UnitTestExtrasProtoFile.UnpackedDoubleExtension, 1));
Assert.AreEqual(false, message.GetExtension(UnitTestExtrasProtoFile.UnpackedBoolExtension, 1));
Assert.AreEqual(UnpackedExtensionsForeignEnum.FOREIGN_BAZ, message.GetExtension(UnitTestExtrasProtoFile.UnpackedEnumExtension, 1));
}
private static ByteString goldenPackedFieldsMessage = null;
......
......@@ -348,6 +348,7 @@ namespace Google.ProtocolBuffers
ExtensionRegistry registry = ExtensionRegistry.CreateInstance();
UnitTestLiteProtoFile.RegisterAllExtensions(registry);
UnitTestExtrasLiteProtoFile.RegisterAllExtensions(registry);
TestUnpackedExtensionsLite unpacked = TestUnpackedExtensionsLite.ParseFrom(original.ToByteArray(), registry);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment