summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.Test/Messaging/Reflection
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2009-04-19 16:39:28 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2009-04-19 16:39:28 -0700
commit231ef6422d1b1cd9246b970431bb53001b032b81 (patch)
tree4b3db40a8d5256d800f7dea3e720de5986dd4d16 /src/DotNetOpenAuth.Test/Messaging/Reflection
parent0abfb2fd6872c1e9c827bd5ae82a9e69e72b9207 (diff)
downloadDotNetOpenAuth-231ef6422d1b1cd9246b970431bb53001b032b81.zip
DotNetOpenAuth-231ef6422d1b1cd9246b970431bb53001b032b81.tar.gz
DotNetOpenAuth-231ef6422d1b1cd9246b970431bb53001b032b81.tar.bz2
Turned on runtime contract checking for debug builds and fixed the errors that it caught.
Diffstat (limited to 'src/DotNetOpenAuth.Test/Messaging/Reflection')
-rw-r--r--src/DotNetOpenAuth.Test/Messaging/Reflection/MessageDictionaryTests.cs15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/DotNetOpenAuth.Test/Messaging/Reflection/MessageDictionaryTests.cs b/src/DotNetOpenAuth.Test/Messaging/Reflection/MessageDictionaryTests.cs
index 7083b1e..24171e1 100644
--- a/src/DotNetOpenAuth.Test/Messaging/Reflection/MessageDictionaryTests.cs
+++ b/src/DotNetOpenAuth.Test/Messaging/Reflection/MessageDictionaryTests.cs
@@ -331,17 +331,26 @@ namespace DotNetOpenAuth.Test.Messaging.Reflection {
/// A test for System.Collections.Generic.ICollection&lt;System.Collections.Generic.KeyValuePair&lt;System.String,System.String&lt;&lt;.Clear
/// </summary>
[TestMethod]
- public void Clear() {
- ICollection<KeyValuePair<string, string>> target = this.MessageDescriptions.GetAccessor(this.message);
+ public void ClearValues() {
+ MessageDictionary target = this.MessageDescriptions.GetAccessor(this.message);
IDictionary<string, string> targetAsDictionary = ((IDictionary<string, string>)target);
this.message.Name = "Andrew";
this.message.Age = 15;
targetAsDictionary["extra"] = "value";
- target.Clear();
+ target.ClearValues();
Assert.AreEqual(2, target.Count, "Clearing should remove all keys except for declared non-nullable structs.");
Assert.IsFalse(targetAsDictionary.ContainsKey("extra"));
Assert.IsNull(this.message.Name);
Assert.AreEqual(0, this.message.Age);
}
+
+ /// <summary>
+ /// Verifies that the Clear method throws the expected exception.
+ /// </summary>
+ [TestMethod, ExpectedException(typeof(NotSupportedException))]
+ public void Clear() {
+ MessageDictionary target = this.MessageDescriptions.GetAccessor(this.message);
+ target.Clear();
+ }
}
}