diff options
author | csharptest <roger@csharptest.net> | 2011-10-01 15:10:05 -0500 |
---|---|---|
committer | rogerk <devnull@localhost> | 2011-10-01 15:10:05 -0500 |
commit | b5a7ed241127412d4d9c22c79b3961239bef49e8 (patch) | |
tree | 4ce8fc01ec3208751050c347d54c41eef8e545b3 /src/ProtocolBuffers.Test/TestWriterFormatJson.cs | |
parent | 4ad552692f737dc27e0ea7829eb8f771b852013c (diff) | |
download | protobuf-b5a7ed241127412d4d9c22c79b3961239bef49e8.tar.gz protobuf-b5a7ed241127412d4d9c22c79b3961239bef49e8.tar.bz2 protobuf-b5a7ed241127412d4d9c22c79b3961239bef49e8.zip |
Conditional extensions in serialization, Removed usages of extensions methods from unit tests
Diffstat (limited to 'src/ProtocolBuffers.Test/TestWriterFormatJson.cs')
-rw-r--r-- | src/ProtocolBuffers.Test/TestWriterFormatJson.cs | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/ProtocolBuffers.Test/TestWriterFormatJson.cs b/src/ProtocolBuffers.Test/TestWriterFormatJson.cs index 1a1a480d..98215ebc 100644 --- a/src/ProtocolBuffers.Test/TestWriterFormatJson.cs +++ b/src/ProtocolBuffers.Test/TestWriterFormatJson.cs @@ -15,7 +15,8 @@ namespace Google.ProtocolBuffers {
TestXmlMessage.Builder builder = TestXmlMessage.CreateBuilder();
- builder.MergeFromJson(@"{""valid"":true}");
+ //3.5: builder.MergeFromJson(@"{""valid"":true}");
+ Extensions.MergeFromJson(builder, @"{""valid"":true}");
TestXmlMessage message = builder.Build();
Assert.AreEqual(true, message.Valid);
@@ -29,7 +30,8 @@ namespace Google.ProtocolBuffers .SetValid(true)
.Build();
- string json = message.ToJson();
+ //3.5: string json = message.ToJson();
+ string json = Extensions.ToJson(message);
Assert.AreEqual(@"{""valid"":true}", json);
}
@@ -100,9 +102,9 @@ namespace Google.ProtocolBuffers public void TestToJsonParseFromJson()
{
TestAllTypes msg = new TestAllTypes.Builder().SetDefaultBool(true).Build();
- string json = msg.ToJson();
+ string json = Extensions.ToJson(msg);
Assert.AreEqual("{\"default_bool\":true}", json);
- TestAllTypes copy = new TestAllTypes.Builder().MergeFromJson(json).Build();
+ TestAllTypes copy = Extensions.MergeFromJson(new TestAllTypes.Builder(), json).Build();
Assert.IsTrue(copy.HasDefaultBool && copy.DefaultBool);
Assert.AreEqual(msg, copy);
}
@@ -111,9 +113,9 @@ namespace Google.ProtocolBuffers public void TestToJsonParseFromJsonReader()
{
TestAllTypes msg = new TestAllTypes.Builder().SetDefaultBool(true).Build();
- string json = msg.ToJson();
+ string json = Extensions.ToJson(msg);
Assert.AreEqual("{\"default_bool\":true}", json);
- TestAllTypes copy = new TestAllTypes.Builder().MergeFromJson(new StringReader(json)).Build();
+ TestAllTypes copy = Extensions.MergeFromJson(new TestAllTypes.Builder(), new StringReader(json)).Build();
Assert.IsTrue(copy.HasDefaultBool && copy.DefaultBool);
Assert.AreEqual(msg, copy);
}
@@ -429,7 +431,7 @@ namespace Google.ProtocolBuffers StringBuilder sb = new StringBuilder(8192);
for (int i = 0; i < 80; i++)
sb.Append("{\"child\":");
- TestXmlRescursive msg = new TestXmlRescursive.Builder().MergeFromJson(sb.ToString()).Build();
+ TestXmlRescursive msg = Extensions.MergeFromJson(new TestXmlRescursive.Builder(), sb.ToString()).Build();
}
[Test, ExpectedException(typeof(FormatException))]
public void FailWithEmptyText()
|