blob: b7cfca6a1e3ea465e1072fd3c794b1c3c67c7673 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
using System.IO;
using Google.ProtocolBuffers.Serialization;
using Google.ProtocolBuffers.TestProtos;
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 = XmlFormatWriter.CreateInstance(text);
writer.WriteMessage("root", message);
return text.ToString();
}
protected override TBuilder DeerializeMessage<TMessage, TBuilder>(object message, TBuilder builder, ExtensionRegistry registry)
{
XmlFormatReader reader = XmlFormatReader.CreateInstance((string)message);
return reader.Merge("root", builder, registry);
}
}
}
|