diff options
Diffstat (limited to 'src/DotNetOpenAuth.Messaging')
4 files changed, 30 insertions, 14 deletions
diff --git a/src/DotNetOpenAuth.Messaging/Configuration/DotNetOpenAuthSection.cs b/src/DotNetOpenAuth.Messaging/Configuration/DotNetOpenAuthSection.cs index 70c8cce..e0c7fc4 100644 --- a/src/DotNetOpenAuth.Messaging/Configuration/DotNetOpenAuthSection.cs +++ b/src/DotNetOpenAuth.Messaging/Configuration/DotNetOpenAuthSection.cs @@ -33,24 +33,12 @@ namespace DotNetOpenAuth.Configuration { private const string OAuthElementName = "oauth"; /// <summary> - /// A value indicating whether this instance came from a real Configuration instance. - /// </summary> - private bool synthesizedInstance; - - /// <summary> /// Initializes a new instance of the <see cref="DotNetOpenAuthSection"/> class. /// </summary> internal DotNetOpenAuthSection() { } /// <summary> - /// Initializes a new instance of the <see cref="DotNetOpenAuthSection"/> class. - /// </summary> - private DotNetOpenAuthSection(bool synthesized) { - this.synthesizedInstance = synthesized; - } - - /// <summary> /// Gets the messaging configuration element. /// </summary> public static MessagingElement Messaging { @@ -67,6 +55,8 @@ namespace DotNetOpenAuth.Configuration { /// <summary> /// Gets a named section in this section group, or <c>null</c> if no such section is defined. /// </summary> + /// <param name="name">The name of the section to obtain.</param> + /// <returns>The desired section, or null if it could not be obtained.</returns> internal static ConfigurationSection GetNamedSection(string name) { string fullyQualifiedSectionName = SectionName + "/" + name; if (HttpContext.Current != null) { diff --git a/src/DotNetOpenAuth.Messaging/DotNetOpenAuth.Messaging.csproj b/src/DotNetOpenAuth.Messaging/DotNetOpenAuth.Messaging.csproj index 801f447..68d1864 100644 --- a/src/DotNetOpenAuth.Messaging/DotNetOpenAuth.Messaging.csproj +++ b/src/DotNetOpenAuth.Messaging/DotNetOpenAuth.Messaging.csproj @@ -11,7 +11,6 @@ <ProjectGuid>{60426312-6AE5-4835-8667-37EDEA670222}</ProjectGuid> <AppDesignerFolder>Properties</AppDesignerFolder> <AssemblyName>DotNetOpenAuth.Messaging</AssemblyName> - <CodeContractsRewritingDisabled>true</CodeContractsRewritingDisabled> </PropertyGroup> <Import Project="$(ProjectRoot)tools\DotNetOpenAuth.Product.props" /> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> diff --git a/src/DotNetOpenAuth.Messaging/Properties/AssemblyInfo.cs b/src/DotNetOpenAuth.Messaging/Properties/AssemblyInfo.cs index 9426fb5..25999da 100644 --- a/src/DotNetOpenAuth.Messaging/Properties/AssemblyInfo.cs +++ b/src/DotNetOpenAuth.Messaging/Properties/AssemblyInfo.cs @@ -64,6 +64,7 @@ using System.Web.UI; [assembly: InternalsVisibleTo("DotNetOpenAuth.OAuth2.AuthorizationServer, PublicKey=0024000004800000940000000602000000240000525341310004000001000100AD093C3765257C89A7010E853F2C7C741FF92FA8ACE06D7B8254702CAD5CF99104447F63AB05F8BB6F51CE0D81C8C93D2FCE8C20AAFF7042E721CBA16EAAE98778611DED11C0ABC8900DC5667F99B50A9DADEC24DBD8F2C91E3E8AD300EF64F1B4B9536CEB16FB440AF939F57624A9B486F867807C649AE4830EAB88C6C03998")] [assembly: InternalsVisibleTo("DotNetOpenAuth.OAuth2.ResourceServer, PublicKey=0024000004800000940000000602000000240000525341310004000001000100AD093C3765257C89A7010E853F2C7C741FF92FA8ACE06D7B8254702CAD5CF99104447F63AB05F8BB6F51CE0D81C8C93D2FCE8C20AAFF7042E721CBA16EAAE98778611DED11C0ABC8900DC5667F99B50A9DADEC24DBD8F2C91E3E8AD300EF64F1B4B9536CEB16FB440AF939F57624A9B486F867807C649AE4830EAB88C6C03998")] [assembly: InternalsVisibleTo("DotNetOpenAuth.OAuth2.Client, PublicKey=0024000004800000940000000602000000240000525341310004000001000100AD093C3765257C89A7010E853F2C7C741FF92FA8ACE06D7B8254702CAD5CF99104447F63AB05F8BB6F51CE0D81C8C93D2FCE8C20AAFF7042E721CBA16EAAE98778611DED11C0ABC8900DC5667F99B50A9DADEC24DBD8F2C91E3E8AD300EF64F1B4B9536CEB16FB440AF939F57624A9B486F867807C649AE4830EAB88C6C03998")] +[assembly: InternalsVisibleTo("DotNetOpenAuth.OAuth2.Client.UI, PublicKey=0024000004800000940000000602000000240000525341310004000001000100AD093C3765257C89A7010E853F2C7C741FF92FA8ACE06D7B8254702CAD5CF99104447F63AB05F8BB6F51CE0D81C8C93D2FCE8C20AAFF7042E721CBA16EAAE98778611DED11C0ABC8900DC5667F99B50A9DADEC24DBD8F2C91E3E8AD300EF64F1B4B9536CEB16FB440AF939F57624A9B486F867807C649AE4830EAB88C6C03998")] #else [assembly: InternalsVisibleTo("DotNetOpenAuth.Test")] [assembly: InternalsVisibleTo("DotNetOpenAuth.InfoCard")] diff --git a/src/DotNetOpenAuth.Messaging/Requires.cs b/src/DotNetOpenAuth.Messaging/Requires.cs index e322da7..ce3a01f 100644 --- a/src/DotNetOpenAuth.Messaging/Requires.cs +++ b/src/DotNetOpenAuth.Messaging/Requires.cs @@ -46,6 +46,18 @@ namespace DotNetOpenAuth { } /// <summary> + /// Validates that an array is not null or empty. + /// </summary> + /// <param name="value">The value.</param> + /// <param name="parameterName">Name of the parameter.</param> + [Pure, ContractArgumentValidator, DebuggerStepThrough] + internal static void NotNullOrEmpty<T>(IEnumerable<T> value, string parameterName) { + NotNull(value, parameterName); + True(value.Any(), parameterName, Strings.InvalidArgument); + Contract.EndContractBlock(); + } + + /// <summary> /// Validates that an argument is either null or is a sequence with no null elements. /// </summary> /// <typeparam name="T">The type of elements in the sequence.</typeparam> @@ -82,7 +94,7 @@ namespace DotNetOpenAuth { /// <param name="parameterName">Name of the parameter.</param> /// <param name="message">The message to include with the exception.</param> [Pure, ContractArgumentValidator, DebuggerStepThrough] - internal static void True(bool condition, string parameterName, string message = null) { + internal static void True(bool condition, string parameterName = null, string message = null) { if (!condition) { throw new ArgumentException(message ?? Strings.InvalidArgument, parameterName); } @@ -163,6 +175,20 @@ namespace DotNetOpenAuth { } /// <summary> + /// Validates some expression describing the acceptable condition for an argument evaluates to true. + /// </summary> + /// <param name="condition">The expression that must evaluate to true to avoid an <see cref="FormatException"/>.</param> + /// <param name="message">The message.</param> + [Pure, ContractArgumentValidator, DebuggerStepThrough] + internal static void Format(bool condition, string message) { + if (!condition) { + throw new FormatException(message); + } + + Contract.EndContractBlock(); + } + + /// <summary> /// Throws an <see cref="NotSupportedException"/> if a condition does not evaluate to <c>true</c>. /// </summary> /// <param name="condition">The expression that must evaluate to true to avoid an <see cref="NotSupportedException"/>.</param> |