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/DictionaryCompatibilityTests.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/DictionaryCompatibilityTests.cs')
-rw-r--r-- | src/ProtocolBuffers.Test/Compatibility/DictionaryCompatibilityTests.cs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/ProtocolBuffers.Test/Compatibility/DictionaryCompatibilityTests.cs b/src/ProtocolBuffers.Test/Compatibility/DictionaryCompatibilityTests.cs new file mode 100644 index 00000000..188c5bc3 --- /dev/null +++ b/src/ProtocolBuffers.Test/Compatibility/DictionaryCompatibilityTests.cs @@ -0,0 +1,37 @@ +using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Text;
+using Google.ProtocolBuffers.Serialization;
+using NUnit.Framework;
+
+namespace Google.ProtocolBuffers.Compatibility
+{
+ [TestFixture]
+ public class DictionaryCompatibilityTests : CompatibilityTests
+ {
+ protected override object SerializeMessage<TMessage, TBuilder>(TMessage message)
+ {
+ DictionaryWriter writer = new DictionaryWriter();
+ writer.WriteMessage(message);
+ return writer.ToDictionary();
+ }
+
+ protected override TBuilder DeserializeMessage<TMessage, TBuilder>(object message, TBuilder builder, ExtensionRegistry registry)
+ {
+ new DictionaryReader((IDictionary<string, object>)message).Merge(builder);
+ return builder;
+ }
+
+ protected override void AssertOutputEquals(object lhs, object rhs)
+ {
+ IDictionary<string, object> left = (IDictionary<string, object>)lhs;
+ IDictionary<string, object> right = (IDictionary<string, object>)rhs;
+
+ Assert.AreEqual(
+ String.Join(",", new List<string>(left.Keys).ToArray()),
+ String.Join(",", new List<string>(right.Keys).ToArray())
+ );
+ }
+ }
+}
\ No newline at end of file |