diff options
Diffstat (limited to 'src/DotNetOpenAuth.Core/Messaging/Reflection')
7 files changed, 12 insertions, 5 deletions
diff --git a/src/DotNetOpenAuth.Core/Messaging/Reflection/DefaultEncoderAttribute.cs b/src/DotNetOpenAuth.Core/Messaging/Reflection/DefaultEncoderAttribute.cs index d827972..adf0f33 100644 --- a/src/DotNetOpenAuth.Core/Messaging/Reflection/DefaultEncoderAttribute.cs +++ b/src/DotNetOpenAuth.Core/Messaging/Reflection/DefaultEncoderAttribute.cs @@ -9,6 +9,7 @@ namespace DotNetOpenAuth.Messaging.Reflection { using System.Collections.Generic; using System.Linq; using System.Text; + using Validation; /// <summary> /// Allows a custom class or struct to be serializable between itself and a string representation. @@ -21,7 +22,7 @@ namespace DotNetOpenAuth.Messaging.Reflection { /// <param name="converterType">The <see cref="IMessagePartEncoder"/> implementing type to use for serializing this type.</param> public DefaultEncoderAttribute(Type converterType) { Requires.NotNull(converterType, "converterType"); - Requires.True(typeof(IMessagePartEncoder).IsAssignableFrom(converterType), "Argument must be a type that implements {0}.", typeof(IMessagePartEncoder).Name); + Requires.That(typeof(IMessagePartEncoder).IsAssignableFrom(converterType), "Argument must be a type that implements {0}.", typeof(IMessagePartEncoder).Name); this.Encoder = (IMessagePartEncoder)Activator.CreateInstance(converterType); } diff --git a/src/DotNetOpenAuth.Core/Messaging/Reflection/IMessagePartEncoder.cs b/src/DotNetOpenAuth.Core/Messaging/Reflection/IMessagePartEncoder.cs index 6186cd7..98c9cce 100644 --- a/src/DotNetOpenAuth.Core/Messaging/Reflection/IMessagePartEncoder.cs +++ b/src/DotNetOpenAuth.Core/Messaging/Reflection/IMessagePartEncoder.cs @@ -10,6 +10,7 @@ namespace DotNetOpenAuth.Messaging.Reflection { using System.Diagnostics.Contracts; using System.Linq; using System.Text; + using Validation; /// <summary> /// An interface describing how various objects can be serialized and deserialized between their object and string forms. diff --git a/src/DotNetOpenAuth.Core/Messaging/Reflection/MessageDescription.cs b/src/DotNetOpenAuth.Core/Messaging/Reflection/MessageDescription.cs index 7e67842..8a34be6 100644 --- a/src/DotNetOpenAuth.Core/Messaging/Reflection/MessageDescription.cs +++ b/src/DotNetOpenAuth.Core/Messaging/Reflection/MessageDescription.cs @@ -12,6 +12,7 @@ namespace DotNetOpenAuth.Messaging.Reflection { using System.Globalization; using System.Linq; using System.Reflection; + using Validation; /// <summary> /// A mapping between serialized key names and <see cref="MessagePart"/> instances describing @@ -30,7 +31,7 @@ namespace DotNetOpenAuth.Messaging.Reflection { /// <param name="messageType">Type of the message.</param> /// <param name="messageVersion">The message version.</param> internal MessageDescription(Type messageType, Version messageVersion) { - Requires.NotNullSubtype<IMessage>(messageType, "messageType"); + RequiresEx.NotNullSubtype<IMessage>(messageType, "messageType"); Requires.NotNull(messageVersion, "messageVersion"); this.MessageType = messageType; diff --git a/src/DotNetOpenAuth.Core/Messaging/Reflection/MessageDescriptionCollection.cs b/src/DotNetOpenAuth.Core/Messaging/Reflection/MessageDescriptionCollection.cs index 3517abc..e3d612e 100644 --- a/src/DotNetOpenAuth.Core/Messaging/Reflection/MessageDescriptionCollection.cs +++ b/src/DotNetOpenAuth.Core/Messaging/Reflection/MessageDescriptionCollection.cs @@ -10,6 +10,7 @@ namespace DotNetOpenAuth.Messaging.Reflection { using System.Diagnostics.CodeAnalysis; using System.Diagnostics.Contracts; using System.Linq; + using Validation; /// <summary> /// A cache of <see cref="MessageDescription"/> instances. @@ -68,7 +69,7 @@ namespace DotNetOpenAuth.Messaging.Reflection { [SuppressMessage("Microsoft.Globalization", "CA1303:Do not pass literals as localized parameters", MessageId = "System.Diagnostics.Contracts.__ContractsRuntime.Assume(System.Boolean,System.String,System.String)", Justification = "No localization required.")] [Pure] internal MessageDescription Get(Type messageType, Version messageVersion) { - Requires.NotNullSubtype<IMessage>(messageType, "messageType"); + RequiresEx.NotNullSubtype<IMessage>(messageType, "messageType"); Requires.NotNull(messageVersion, "messageVersion"); Contract.Ensures(Contract.Result<MessageDescription>() != null); diff --git a/src/DotNetOpenAuth.Core/Messaging/Reflection/MessageDictionary.cs b/src/DotNetOpenAuth.Core/Messaging/Reflection/MessageDictionary.cs index cf44863..c3e6f65 100644 --- a/src/DotNetOpenAuth.Core/Messaging/Reflection/MessageDictionary.cs +++ b/src/DotNetOpenAuth.Core/Messaging/Reflection/MessageDictionary.cs @@ -11,6 +11,7 @@ namespace DotNetOpenAuth.Messaging.Reflection { using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Diagnostics.Contracts; + using Validation; /// <summary> /// Wraps an <see cref="IMessage"/> instance in a dictionary that diff --git a/src/DotNetOpenAuth.Core/Messaging/Reflection/MessagePart.cs b/src/DotNetOpenAuth.Core/Messaging/Reflection/MessagePart.cs index a6e8da2..6c9aef3 100644 --- a/src/DotNetOpenAuth.Core/Messaging/Reflection/MessagePart.cs +++ b/src/DotNetOpenAuth.Core/Messaging/Reflection/MessagePart.cs @@ -16,6 +16,7 @@ namespace DotNetOpenAuth.Messaging.Reflection { using System.Reflection; using System.Xml; using DotNetOpenAuth.Configuration; + using Validation; /// <summary> /// Describes an individual member of a message and assists in its serialization. @@ -106,7 +107,7 @@ namespace DotNetOpenAuth.Messaging.Reflection { [SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity", Justification = "Unavoidable"), SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily", Justification = "Code contracts requires it.")] internal MessagePart(MemberInfo member, MessagePartAttribute attribute) { Requires.NotNull(member, "member"); - Requires.True(member is FieldInfo || member is PropertyInfo, "member"); + Requires.That(member is FieldInfo || member is PropertyInfo, "member", "Member must be a property or field."); Requires.NotNull(attribute, "attribute"); this.field = member as FieldInfo; @@ -203,7 +204,7 @@ namespace DotNetOpenAuth.Messaging.Reflection { /// </summary> internal string StaticConstantValue { get { - Requires.ValidState(this.IsConstantValueAvailableStatically); + RequiresEx.ValidState(this.IsConstantValueAvailableStatically); return this.ToString(this.field.GetValue(null), false); } } diff --git a/src/DotNetOpenAuth.Core/Messaging/Reflection/ValueMapping.cs b/src/DotNetOpenAuth.Core/Messaging/Reflection/ValueMapping.cs index 4139f52..7acff7e 100644 --- a/src/DotNetOpenAuth.Core/Messaging/Reflection/ValueMapping.cs +++ b/src/DotNetOpenAuth.Core/Messaging/Reflection/ValueMapping.cs @@ -7,6 +7,7 @@ namespace DotNetOpenAuth.Messaging.Reflection { using System; using System.Diagnostics.Contracts; + using Validation; /// <summary> /// A pair of conversion functions to map some type to a string and back again. |