aboutsummaryrefslogblamecommitdiff
path: root/src/ProtocolBuffers.Test/CompatTests/XmlCompatibilityTests.cs
blob: e204200d8e136c47a58a5dafade68755bd837d66 (plain) (tree)























                                                                                                                                        
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);
        }
    }
}