aboutsummaryrefslogtreecommitdiffhomepage
path: root/csharp/src/Google.Protobuf.Conformance/Program.cs
diff options
context:
space:
mode:
Diffstat (limited to 'csharp/src/Google.Protobuf.Conformance/Program.cs')
-rw-r--r--csharp/src/Google.Protobuf.Conformance/Program.cs18
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);
}