diff options
author | csharptest <roger@csharptest.net> | 2011-07-14 13:40:09 -0500 |
---|---|---|
committer | rogerk <devnull@localhost> | 2011-07-14 13:40:09 -0500 |
commit | b5ba93bf3c24b6c10468d98df3d1fb7f5cd2b3a0 (patch) | |
tree | cbdf3cbe904fe087366089851a1c71d7fff87c43 /src/ProtocolBuffers.Test/Compatibility/XmlCompatibilityTests.cs | |
parent | 84f7e09f0279cb1cf32c104d4c6ccf79539795ed (diff) | |
download | protobuf-b5ba93bf3c24b6c10468d98df3d1fb7f5cd2b3a0.tar.gz protobuf-b5ba93bf3c24b6c10468d98df3d1fb7f5cd2b3a0.tar.bz2 protobuf-b5ba93bf3c24b6c10468d98df3d1fb7f5cd2b3a0.zip |
Integrated feedback from revision c97eeb8d933f
Diffstat (limited to 'src/ProtocolBuffers.Test/Compatibility/XmlCompatibilityTests.cs')
-rw-r--r-- | src/ProtocolBuffers.Test/Compatibility/XmlCompatibilityTests.cs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/ProtocolBuffers.Test/Compatibility/XmlCompatibilityTests.cs b/src/ProtocolBuffers.Test/Compatibility/XmlCompatibilityTests.cs new file mode 100644 index 00000000..50ef6f03 --- /dev/null +++ b/src/ProtocolBuffers.Test/Compatibility/XmlCompatibilityTests.cs @@ -0,0 +1,25 @@ +using System.IO;
+using Google.ProtocolBuffers.Serialization;
+using Google.ProtocolBuffers.TestProtos;
+using NUnit.Framework;
+
+namespace Google.ProtocolBuffers.Compatibility
+{
+ [TestFixture]
+ public class XmlCompatibilityTests : CompatibilityTests
+ {
+ protected override object SerializeMessage<TMessage, TBuilder>(TMessage message)
+ {
+ StringWriter text = new StringWriter();
+ XmlFormatWriter writer = XmlFormatWriter.CreateInstance(text);
+ writer.WriteMessage("root", message);
+ return text.ToString();
+ }
+
+ protected override TBuilder DeserializeMessage<TMessage, TBuilder>(object message, TBuilder builder, ExtensionRegistry registry)
+ {
+ XmlFormatReader reader = XmlFormatReader.CreateInstance((string)message);
+ return reader.Merge("root", builder, registry);
+ }
+ }
+}
\ No newline at end of file |