aboutsummaryrefslogtreecommitdiff
path: root/src/ProtocolBuffers.Test/CompatTests/XmlCompatibilityTests.cs
diff options
context:
space:
mode:
authorcsharptest <roger@csharptest.net>2011-06-10 14:41:47 -0500
committerrogerk <devnull@localhost>2011-06-10 14:41:47 -0500
commit2b86884659413efb1cbbcf7ebe22ef46a565b13d (patch)
treee35e2776944153fbcad1a146b4b37ae9ed691a41 /src/ProtocolBuffers.Test/CompatTests/XmlCompatibilityTests.cs
parentb00ea13eb1b8055a0cde89d01bbde6d95e5cd1a5 (diff)
downloadprotobuf-2b86884659413efb1cbbcf7ebe22ef46a565b13d.tar.gz
protobuf-2b86884659413efb1cbbcf7ebe22ef46a565b13d.tar.bz2
protobuf-2b86884659413efb1cbbcf7ebe22ef46a565b13d.zip
Added the XmlFormatWriter/Reader
Diffstat (limited to 'src/ProtocolBuffers.Test/CompatTests/XmlCompatibilityTests.cs')
-rw-r--r--src/ProtocolBuffers.Test/CompatTests/XmlCompatibilityTests.cs24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/ProtocolBuffers.Test/CompatTests/XmlCompatibilityTests.cs b/src/ProtocolBuffers.Test/CompatTests/XmlCompatibilityTests.cs
new file mode 100644
index 00000000..e204200d
--- /dev/null
+++ b/src/ProtocolBuffers.Test/CompatTests/XmlCompatibilityTests.cs
@@ -0,0 +1,24 @@
+using System.IO;
+using Google.ProtocolBuffers.Serialization;
+using NUnit.Framework;
+
+namespace Google.ProtocolBuffers.CompatTests
+{
+ [TestFixture]
+ public class XmlCompatibilityTests : CompatibilityTests
+ {
+ protected override object SerializeMessage<TMessage, TBuilder>(TMessage message)
+ {
+ StringWriter text = new StringWriter();
+ XmlFormatWriter writer = new XmlFormatWriter(text);
+ writer.WriteMessage("root", message);
+ return text.ToString();
+ }
+
+ protected override TBuilder DeerializeMessage<TMessage, TBuilder>(object message, TBuilder builder, ExtensionRegistry registry)
+ {
+ XmlFormatReader reader = new XmlFormatReader((string)message);
+ return reader.Merge("root", builder, registry);
+ }
+ }
+} \ No newline at end of file