diff options
author | csharptest <roger@csharptest.net> | 2011-06-10 16:03:22 -0500 |
---|---|---|
committer | rogerk <devnull@localhost> | 2011-06-10 16:03:22 -0500 |
commit | afe844bc95f8a0b2399315e618b636a6f32191dd (patch) | |
tree | 324e6b9a3c1c73622565548faa4e42a44642e24f /src/ProtocolBuffers.Test/CompatTests/JsonCompatibilityTests.cs | |
parent | 2b86884659413efb1cbbcf7ebe22ef46a565b13d (diff) | |
download | protobuf-afe844bc95f8a0b2399315e618b636a6f32191dd.tar.gz protobuf-afe844bc95f8a0b2399315e618b636a6f32191dd.tar.bz2 protobuf-afe844bc95f8a0b2399315e618b636a6f32191dd.zip |
Added the JsonFormatWriter/Reader
Diffstat (limited to 'src/ProtocolBuffers.Test/CompatTests/JsonCompatibilityTests.cs')
-rw-r--r-- | src/ProtocolBuffers.Test/CompatTests/JsonCompatibilityTests.cs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/ProtocolBuffers.Test/CompatTests/JsonCompatibilityTests.cs b/src/ProtocolBuffers.Test/CompatTests/JsonCompatibilityTests.cs new file mode 100644 index 00000000..30a08398 --- /dev/null +++ b/src/ProtocolBuffers.Test/CompatTests/JsonCompatibilityTests.cs @@ -0,0 +1,26 @@ +using System.IO;
+using System.Text;
+using Google.ProtocolBuffers.Serialization;
+using NUnit.Framework;
+
+namespace Google.ProtocolBuffers.CompatTests
+{
+ [TestFixture]
+ public class JsonCompatibilityTests : CompatibilityTests
+ {
+ protected override object SerializeMessage<TMessage, TBuilder>(TMessage message)
+ {
+ StringWriter sw = new StringWriter();
+ new JsonFormatWriter(sw)
+ .Formatted()
+ .WriteMessage(message);
+ return sw.ToString();
+ }
+
+ protected override TBuilder DeerializeMessage<TMessage, TBuilder>(object message, TBuilder builder, ExtensionRegistry registry)
+ {
+ new JsonFormatReader((string)message).Merge(builder);
+ return builder;
+ }
+ }
+}
\ No newline at end of file |