aboutsummaryrefslogtreecommitdiff
path: root/csharp/src/Google.Protobuf.Test/Collections/MapFieldTest.cs
diff options
context:
space:
mode:
authorJan Tattermusch <jtattermusch@google.com>2015-07-29 16:05:57 -0700
committerJan Tattermusch <jtattermusch@google.com>2015-07-29 20:26:20 -0700
commit3783d9a8add33b240e326438fa0b16869dbcfb44 (patch)
treeda62a6324d13214803065ec47c36867aeae755f5 /csharp/src/Google.Protobuf.Test/Collections/MapFieldTest.cs
parent74810c6ae3219498dd3e856f9cd251588c92a899 (diff)
downloadprotobuf-3783d9a8add33b240e326438fa0b16869dbcfb44.tar.gz
protobuf-3783d9a8add33b240e326438fa0b16869dbcfb44.tar.bz2
protobuf-3783d9a8add33b240e326438fa0b16869dbcfb44.zip
remove the freeze API
Diffstat (limited to 'csharp/src/Google.Protobuf.Test/Collections/MapFieldTest.cs')
-rw-r--r--csharp/src/Google.Protobuf.Test/Collections/MapFieldTest.cs56
1 files changed, 0 insertions, 56 deletions
diff --git a/csharp/src/Google.Protobuf.Test/Collections/MapFieldTest.cs b/csharp/src/Google.Protobuf.Test/Collections/MapFieldTest.cs
index 46d3bd9a..c62ac046 100644
--- a/csharp/src/Google.Protobuf.Test/Collections/MapFieldTest.cs
+++ b/csharp/src/Google.Protobuf.Test/Collections/MapFieldTest.cs
@@ -45,53 +45,6 @@ namespace Google.Protobuf.Collections
/// </summary>
public class MapFieldTest
{
- // Protobuf-specific tests
- [Test]
- public void Freeze_FreezesMessages()
- {
- var message = new ForeignMessage { C = 20 };
- var map = new MapField<string, ForeignMessage> { { "x", message } };
- map.Freeze();
- Assert.IsTrue(message.IsFrozen);
- }
-
- [Test]
- public void Freeze_Idempotent()
- {
- var message = new ForeignMessage { C = 20 };
- var map = new MapField<string, ForeignMessage> { { "x", message } };
- Assert.IsFalse(map.IsFrozen);
- map.Freeze();
- Assert.IsTrue(message.IsFrozen);
- map.Freeze();
- Assert.IsTrue(message.IsFrozen);
- }
-
- [Test]
- public void Freeze_PreventsMutation()
- {
- var map = new MapField<string, string>();
- map.Freeze();
- Assert.IsTrue(map.IsFrozen);
- Assert.IsTrue(map.IsReadOnly);
- ICollection<KeyValuePair<string, string>> collection = map;
- Assert.Throws<InvalidOperationException>(() => map["x"] = "y");
- Assert.Throws<InvalidOperationException>(() => map.Add("x", "y"));
- Assert.Throws<InvalidOperationException>(() => map.Remove("x"));
- Assert.Throws<InvalidOperationException>(() => map.Clear());
- Assert.Throws<InvalidOperationException>(() => collection.Add(NewKeyValuePair("x", "y")));
- Assert.Throws<InvalidOperationException>(() => collection.Remove(NewKeyValuePair("x", "y")));
- }
-
- [Test]
- public void Clone_ReturnsNonFrozen()
- {
- var map = new MapField<string, string>();
- map.Freeze();
- var clone = map.Clone();
- clone.Add("x", "y");
- }
-
[Test]
public void Clone_ClonesMessages()
{
@@ -422,10 +375,6 @@ namespace Google.Protobuf.Collections
dictionary.Remove("x");
Assert.AreEqual(0, dictionary.Count);
Assert.Throws<ArgumentNullException>(() => dictionary.Remove(null));
-
- map.Freeze();
- // Call should fail even though it clearly doesn't contain 5 as a key.
- Assert.Throws<InvalidOperationException>(() => dictionary.Remove(5));
}
[Test]
@@ -449,8 +398,6 @@ namespace Google.Protobuf.Collections
var map = new MapField<string, string> { { "x", "y" } };
IDictionary dictionary = map;
Assert.IsFalse(dictionary.IsFixedSize);
- map.Freeze();
- Assert.IsTrue(dictionary.IsFixedSize);
}
[Test]
@@ -504,9 +451,6 @@ namespace Google.Protobuf.Collections
Assert.Throws<InvalidCastException>(() => dictionary["x"] = 5);
Assert.Throws<ArgumentNullException>(() => dictionary[null] = "z");
Assert.Throws<ArgumentNullException>(() => dictionary["x"] = null);
- map.Freeze();
- // Note: Not InvalidOperationException.
- Assert.Throws<NotSupportedException>(() => dictionary["a"] = "c");
}
[Test]