aboutsummaryrefslogtreecommitdiff
path: root/src/ProtocolBuffers.Test/ReusableBuilderTest.cs
diff options
context:
space:
mode:
authorcsharptest <roger@csharptest.net>2011-09-23 10:14:14 -0500
committerrogerk <devnull@localhost>2011-09-23 10:14:14 -0500
commit3b625064e8e40f37ec510cc4f25035a9c1554c73 (patch)
tree6653af535caa18c171ad4177798e6d5e18d17176 /src/ProtocolBuffers.Test/ReusableBuilderTest.cs
parent2a1f0bd44078abb6271091657cde9a1d7dba99e0 (diff)
downloadprotobuf-3b625064e8e40f37ec510cc4f25035a9c1554c73.tar.gz
protobuf-3b625064e8e40f37ec510cc4f25035a9c1554c73.tar.bz2
protobuf-3b625064e8e40f37ec510cc4f25035a9c1554c73.zip
One more test to ensure DefaultInstance is read-only
Diffstat (limited to 'src/ProtocolBuffers.Test/ReusableBuilderTest.cs')
-rw-r--r--src/ProtocolBuffers.Test/ReusableBuilderTest.cs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/ProtocolBuffers.Test/ReusableBuilderTest.cs b/src/ProtocolBuffers.Test/ReusableBuilderTest.cs
index 2f81a814..194313cb 100644
--- a/src/ProtocolBuffers.Test/ReusableBuilderTest.cs
+++ b/src/ProtocolBuffers.Test/ReusableBuilderTest.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Text;
+using Google.ProtocolBuffers.Collections;
using NUnit.Framework;
using Google.ProtocolBuffers.TestProtos;
using Google.ProtocolBuffers.Serialization;
@@ -11,6 +12,15 @@ namespace Google.ProtocolBuffers
public class ReusableBuilderTest
{
[Test]
+ public void TestModifyDefaultInstance()
+ {
+ //verify that the default instance has correctly been marked as read-only
+ Assert.AreEqual(typeof(PopsicleList<bool>), TestAllTypes.DefaultInstance.RepeatedBoolList.GetType());
+ PopsicleList<bool> list = (PopsicleList<bool>)TestAllTypes.DefaultInstance.RepeatedBoolList;
+ Assert.IsTrue(list.IsReadOnly);
+ }
+
+ [Test]
public void TestUnmodifiedDefaultInstance()
{
//Simply calling ToBuilder().Build() no longer creates a copy of the message