diff options
author | csharptest <roger@csharptest.net> | 2011-06-10 14:41:47 -0500 |
---|---|---|
committer | rogerk <devnull@localhost> | 2011-06-10 14:41:47 -0500 |
commit | 2b86884659413efb1cbbcf7ebe22ef46a565b13d (patch) | |
tree | e35e2776944153fbcad1a146b4b37ae9ed691a41 /src/ProtocolBuffers.Test/CompatTests/XmlCompatibilityTests.cs | |
parent | b00ea13eb1b8055a0cde89d01bbde6d95e5cd1a5 (diff) | |
download | protobuf-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.cs | 24 |
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 |