aboutsummaryrefslogtreecommitdiff
path: root/csharp/src/ProtocolBuffersLite.Test/InteropLiteTest.cs
diff options
context:
space:
mode:
authorJon Skeet <jonskeet@google.com>2015-04-28 15:06:59 +0100
committerJon Skeet <jonskeet@google.com>2015-04-28 15:06:59 +0100
commitce66c5f1b99fe36b5b91e8b59cc75ce8a4e9cba5 (patch)
tree84adc050b8ee575f94a5efc13322dd7d344fcff7 /csharp/src/ProtocolBuffersLite.Test/InteropLiteTest.cs
parentf3504cf3b1d456a843e8242fdee9ba0bf2991dc1 (diff)
downloadprotobuf-ce66c5f1b99fe36b5b91e8b59cc75ce8a4e9cba5.tar.gz
protobuf-ce66c5f1b99fe36b5b91e8b59cc75ce8a4e9cba5.tar.bz2
protobuf-ce66c5f1b99fe36b5b91e8b59cc75ce8a4e9cba5.zip
Updated set of unit tests and unit test protos.
This commit includes changes to the C#-specific protos, and rebuilt versions of the "stock" protos. The stock protos have been locally updated to have a specific C# namespace, but this is expected to change soon, so hasn't been committed. Four areas are currently not tested: 1) Serialization - we may restore this at some point, possibly optionally. 2) Services - currently nothing is generated for this; will need to see how it interacts with GRPC 3) Fields beginning with _{digit} - see https://github.com/google/protobuf/issues/308 4) Fields with names which conflict with the declaring type in nasty ways - see https://github.com/google/protobuf/issues/309
Diffstat (limited to 'csharp/src/ProtocolBuffersLite.Test/InteropLiteTest.cs')
-rw-r--r--csharp/src/ProtocolBuffersLite.Test/InteropLiteTest.cs18
1 files changed, 10 insertions, 8 deletions
diff --git a/csharp/src/ProtocolBuffersLite.Test/InteropLiteTest.cs b/csharp/src/ProtocolBuffersLite.Test/InteropLiteTest.cs
index 37739d2f..0640a445 100644
--- a/csharp/src/ProtocolBuffersLite.Test/InteropLiteTest.cs
+++ b/csharp/src/ProtocolBuffersLite.Test/InteropLiteTest.cs
@@ -72,17 +72,19 @@ namespace Google.ProtocolBuffers
.AddAddresses(
TestInteropPerson.Types.Addresses.CreateBuilder().SetAddress("123 Seseme").SetCity("Wonderland").
SetState("NA").SetZip(12345).Build())
- .SetExtension(UnitTestExtrasFullProtoFile.EmployeeId,
+ .SetExtension(UnittestExtrasFull.EmployeeId,
TestInteropEmployeeId.CreateBuilder().SetNumber("123").Build())
.Build();
Assert.IsTrue(person.IsInitialized);
ExtensionRegistry registry = ExtensionRegistry.CreateInstance();
- UnitTestExtrasLiteProtoFile.RegisterAllExtensions(registry);
+ UnittestExtrasLite.RegisterAllExtensions(registry);
+ byte[] fullBytes = person.ToByteArray();
- TestInteropPersonLite copy = TestInteropPersonLite.ParseFrom(person.ToByteArray(), registry);
+ TestInteropPersonLite copy = TestInteropPersonLite.ParseFrom(fullBytes, registry);
+ byte[] liteBytes = copy.ToByteArray();
- TestUtil.AssertBytesEqual(person.ToByteArray(), copy.ToByteArray());
+ TestUtil.AssertBytesEqual(fullBytes, liteBytes);
}
[TestMethod]
@@ -112,13 +114,13 @@ namespace Google.ProtocolBuffers
.AddAddresses(
TestInteropPersonLite.Types.Addresses.CreateBuilder().SetAddress("123 Seseme").SetCity("Wonderland")
.SetState("NA").SetZip(12345).Build())
- .SetExtension(UnitTestExtrasLiteProtoFile.EmployeeIdLite,
+ .SetExtension(UnittestExtrasLite.EmployeeIdLite,
TestInteropEmployeeIdLite.CreateBuilder().SetNumber("123").Build())
.Build();
Assert.IsTrue(person.IsInitialized);
ExtensionRegistry registry = ExtensionRegistry.CreateInstance();
- UnitTestExtrasFullProtoFile.RegisterAllExtensions(registry);
+ UnittestExtrasFull.RegisterAllExtensions(registry);
TestInteropPerson copy = TestInteropPerson.ParseFrom(person.ToByteArray(), registry);
@@ -151,13 +153,13 @@ namespace Google.ProtocolBuffers
.AddAddresses(
TestInteropPersonLite.Types.Addresses.CreateBuilder().SetAddress("123 Seseme").SetCity("Wonderland")
.SetState("NA").SetZip(12345).Build())
- .SetExtension(UnitTestExtrasLiteProtoFile.EmployeeIdLite,
+ .SetExtension(UnittestExtrasLite.EmployeeIdLite,
TestInteropEmployeeIdLite.CreateBuilder().SetNumber("123").Build())
.Build();
Assert.IsTrue(person.IsInitialized);
ExtensionRegistry registry = ExtensionRegistry.CreateInstance();
- UnitTestExtrasFullProtoFile.RegisterAllExtensions(registry);
+ UnittestExtrasFull.RegisterAllExtensions(registry);
TestInteropPerson copy = TestInteropPerson.ParseFrom(person.ToByteArray(), registry);