aboutsummaryrefslogtreecommitdiff
path: root/csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs
diff options
context:
space:
mode:
authorJon Skeet <jonskeet@google.com>2016-07-09 08:02:14 +0100
committerJon Skeet <jonskeet@google.com>2016-07-14 22:14:51 +0100
commit5e0de1ebee532dc2ff4ce88ec2d7bee90817825c (patch)
treedf289024a55a792f2af1be27310f5c55a30a2df0 /csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs
parent2ee1e52380bcda8fccf228447decfc20529172cd (diff)
downloadprotobuf-5e0de1ebee532dc2ff4ce88ec2d7bee90817825c.tar.gz
protobuf-5e0de1ebee532dc2ff4ce88ec2d7bee90817825c.tar.bz2
protobuf-5e0de1ebee532dc2ff4ce88ec2d7bee90817825c.zip
Remove the overload for Add(RepeatedField<T>)
We now just perform the optimization within AddRange itself. This is a breaking change in terms of "drop in the DLL", but is source compatible, which should be fine.
Diffstat (limited to 'csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs')
-rw-r--r--csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs12
1 files changed, 10 insertions, 2 deletions
diff --git a/csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs b/csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs
index f8e3b177..6852f75f 100644
--- a/csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs
+++ b/csharp/src/Google.Protobuf.Test/Collections/RepeatedFieldTest.cs
@@ -153,10 +153,18 @@ namespace Google.Protobuf.Collections
}
[Test]
- public void Add_RepeatedField()
+ public void AddRange_AlreadyNotEmpty()
+ {
+ var list = new RepeatedField<int> { 1, 2, 3 };
+ list.AddRange(new List<int> { 4, 5, 6 });
+ CollectionAssert.AreEqual(new[] { 1, 2, 3, 4, 5, 6 }, list);
+ }
+
+ [Test]
+ public void AddRange_RepeatedField()
{
var list = new RepeatedField<string> { "original" };
- list.Add(new RepeatedField<string> { "foo", "bar" });
+ list.AddRange(new RepeatedField<string> { "foo", "bar" });
Assert.AreEqual(3, list.Count);
Assert.AreEqual("original", list[0]);
Assert.AreEqual("foo", list[1]);