diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2008-09-18 15:40:17 -0700 |
---|---|---|
committer | Andrew <andrewarnott@gmail.com> | 2008-09-18 15:40:17 -0700 |
commit | 95e418aa02296a93587c4e07b0f3eec8cd379416 (patch) | |
tree | 38c97ac46e3b8e1b141ae6d57e1bfe6a42e2db05 /src/DotNetOAuth.Test/Messaging/Reflection/MessagePartTests.cs | |
parent | ea7cae52f40770d1023362dadd234b8038d9e68b (diff) | |
download | DotNetOpenAuth-95e418aa02296a93587c4e07b0f3eec8cd379416.zip DotNetOpenAuth-95e418aa02296a93587c4e07b0f3eec8cd379416.tar.gz DotNetOpenAuth-95e418aa02296a93587c4e07b0f3eec8cd379416.tar.bz2 |
MessageDictionary mostly hooked up and most tests passing.
Diffstat (limited to 'src/DotNetOAuth.Test/Messaging/Reflection/MessagePartTests.cs')
-rw-r--r-- | src/DotNetOAuth.Test/Messaging/Reflection/MessagePartTests.cs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/DotNetOAuth.Test/Messaging/Reflection/MessagePartTests.cs b/src/DotNetOAuth.Test/Messaging/Reflection/MessagePartTests.cs new file mode 100644 index 0000000..646599c --- /dev/null +++ b/src/DotNetOAuth.Test/Messaging/Reflection/MessagePartTests.cs @@ -0,0 +1,27 @@ +using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using DotNetOAuth.Messaging.Reflection;
+using System.Reflection;
+
+namespace DotNetOAuth.Test.Messaging.Reflection {
+ [TestClass]
+ public class MessagePartTests :MessagingTestBase {
+ class MessageWithNonNullableOptionalStruct {
+ /// <summary>
+ /// Optional structs like int must be nullable for Optional to make sense.
+ /// </summary>
+ [MessagePart(IsRequired = false)]
+ internal int optionalInt;
+ }
+
+ [TestMethod, ExpectedException(typeof(ArgumentException))]
+ public void OptionalNonNullableStruct() {
+ FieldInfo field = typeof(MessageWithNonNullableOptionalStruct).GetField("optionalInt", BindingFlags.NonPublic | BindingFlags.Instance);
+ MessagePartAttribute attribute = field.GetCustomAttributes(typeof(MessagePartAttribute), true).OfType<MessagePartAttribute>().Single();
+ new MessagePart(field, attribute); // should recognize invalid optional non-nullable struct
+ }
+ }
+}
|