diff options
author | Yilun Chong <yilunchong@google.com> | 2017-06-28 14:51:56 -0700 |
---|---|---|
committer | Yilun Chong <yilunchong@google.com> | 2017-06-28 14:51:56 -0700 |
commit | cd1dc3f0dfb853d7b72d8494efb5919901f2589b (patch) | |
tree | 063630f4ed4c1ddf140952db5cebe1aba340ef08 /csharp/src/Google.Protobuf.Conformance/Program.cs | |
parent | 364502102afe62bc0a9068032a177d1827aa4774 (diff) | |
download | protobuf-cd1dc3f0dfb853d7b72d8494efb5919901f2589b.tar.gz protobuf-cd1dc3f0dfb853d7b72d8494efb5919901f2589b.tar.bz2 protobuf-cd1dc3f0dfb853d7b72d8494efb5919901f2589b.zip |
add csharp support
Diffstat (limited to 'csharp/src/Google.Protobuf.Conformance/Program.cs')
-rw-r--r-- | csharp/src/Google.Protobuf.Conformance/Program.cs | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/csharp/src/Google.Protobuf.Conformance/Program.cs b/csharp/src/Google.Protobuf.Conformance/Program.cs index 00ee64f8..3d792f79 100644 --- a/csharp/src/Google.Protobuf.Conformance/Program.cs +++ b/csharp/src/Google.Protobuf.Conformance/Program.cs @@ -90,9 +90,23 @@ namespace Google.Protobuf.Conformance var parser = new JsonParser(new JsonParser.Settings(20, typeRegistry)); message = parser.Parse<ProtobufTestMessages.Proto3.TestAllTypes>(request.JsonPayload); break; - case ConformanceRequest.PayloadOneofCase.ProtobufPayload: - message = ProtobufTestMessages.Proto3.TestAllTypes.Parser.ParseFrom(request.ProtobufPayload); + case ConformanceRequest.PayloadOneofCase.ProtobufPayload: + { + if (request.MessageType.Equals("proto3")) + { + message = ProtobufTestMessages.Proto3.TestAllTypes.Parser.ParseFrom(request.ProtobufPayload); + } + else if (request.MessageType.Equals("proto2")) + { + response.Skipped = "Ruby doesn't support proto2"; + return response; + } + else + { + throw new Exception(" Protobuf request doesn't have specific payload type"); + } break; + } default: throw new Exception("Unsupported request payload: " + request.PayloadCase); } |