aboutsummaryrefslogtreecommitdiff
path: root/src/ProtocolBuffers.Test/CompatTests/TextCompatibilityTests.cs
blob: 83f19ae323ae7487dead7e2f9bde32630959867f (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
26
27
28
29
30
31
32
33
34
35
36
37
using System.ComponentModel;
using System.IO;
using NUnit.Framework;

namespace Google.ProtocolBuffers.CompatTests
{
    [TestFixture]
    public class TextCompatibilityTests : CompatibilityTests
    {
        protected override string TestName { get { return "text"; } }

        protected override object SerializeMessage<TMessage, TBuilder>(TMessage message)
        {
            StringWriter text = new StringWriter();
            message.PrintTo(text);
            return text.ToString();
        }

        protected override TBuilder DeerializeMessage<TMessage, TBuilder>(object message, TBuilder builder, ExtensionRegistry registry)
        {
            TextFormat.Merge(new StringReader((string)message), registry, (IBuilder)builder);
            return builder;
        }

        [Test, Explicit, Description("This test can take a very long time to run.")]
        public override void RoundTripMessage2OptimizeSize()
        {
            base.RoundTripMessage2OptimizeSize();
        }

        [Test, Explicit, Description("This test can take a very long time to run.")]
        public override void RoundTripMessage2OptimizeSpeed()
        {
            base.RoundTripMessage2OptimizeSpeed();
        }
    }
}