aboutsummaryrefslogtreecommitdiff
path: root/src/ProtocolBuffers.Test/CompatTests/XmlCompatibilityTests.cs
diff options
context:
space:
mode:
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