diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2012-12-26 08:13:47 -0800 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2012-12-26 08:13:47 -0800 |
commit | 79e45f41efa4acc686ce64624c3af4b440a5cbb5 (patch) | |
tree | a577fa05920ba91214003ddee00038f9df62b280 | |
parent | 06fdacd94eb1a337b6822680336317357885ab48 (diff) | |
download | DotNetOpenAuth-79e45f41efa4acc686ce64624c3af4b440a5cbb5.zip DotNetOpenAuth-79e45f41efa4acc686ce64624c3af4b440a5cbb5.tar.gz DotNetOpenAuth-79e45f41efa4acc686ce64624c3af4b440a5cbb5.tar.bz2 |
StyleCop fixes.
4 files changed, 38 insertions, 35 deletions
diff --git a/src/DotNetOpenAuth.Core/Messaging/HttpRequestInfo.cs b/src/DotNetOpenAuth.Core/Messaging/HttpRequestInfo.cs index d0f6f63..75da833 100644 --- a/src/DotNetOpenAuth.Core/Messaging/HttpRequestInfo.cs +++ b/src/DotNetOpenAuth.Core/Messaging/HttpRequestInfo.cs @@ -80,7 +80,7 @@ namespace DotNetOpenAuth.Messaging { this.form = new NameValueCollection(); this.queryString = HttpUtility.ParseQueryString(requestUri.Query); this.serverVariables = new NameValueCollection(); - this.cookies = new HttpCookieCollection(); + this.cookies = new HttpCookieCollection(); Reporting.RecordRequestStatistics(this); } diff --git a/src/DotNetOpenAuth.Core/Messaging/MessagingUtilities.cs b/src/DotNetOpenAuth.Core/Messaging/MessagingUtilities.cs index bbe28ab..388157a 100644 --- a/src/DotNetOpenAuth.Core/Messaging/MessagingUtilities.cs +++ b/src/DotNetOpenAuth.Core/Messaging/MessagingUtilities.cs @@ -22,8 +22,8 @@ namespace DotNetOpenAuth.Messaging { using System.Runtime.Serialization.Json; using System.Security; using System.Security.Cryptography; - using System.Threading; using System.Text; + using System.Threading; using System.Web; using System.Web.Mvc; using System.Xml; @@ -42,13 +42,6 @@ namespace DotNetOpenAuth.Messaging { internal static readonly RandomNumberGenerator CryptoRandomDataGenerator = new RNGCryptoServiceProvider(); /// <summary> - /// Gets a random number generator for use on the current thread only. - /// </summary> - internal static Random NonCryptoRandomDataGenerator { - get { return ThreadSafeRandom.RandomNumberGenerator; } - } - - /// <summary> /// The uppercase alphabet. /// </summary> internal const string UppercaseLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; @@ -158,6 +151,13 @@ namespace DotNetOpenAuth.Messaging { } /// <summary> + /// Gets a random number generator for use on the current thread only. + /// </summary> + internal static Random NonCryptoRandomDataGenerator { + get { return ThreadSafeRandom.RandomNumberGenerator; } + } + + /// <summary> /// Transforms an OutgoingWebResponse to an MVC-friendly ActionResult. /// </summary> /// <param name="response">The response to send to the user agent.</param> @@ -2015,6 +2015,32 @@ namespace DotNetOpenAuth.Messaging { } /// <summary> + /// A thread-safe, non-crypto random number generator. + /// </summary> + private static class ThreadSafeRandom { + /// <summary> + /// The initializer of all new <see cref="Random"/> instances. + /// </summary> + private static readonly Random threadRandomInitializer = new Random(); + + /// <summary> + /// A thread-local instance of <see cref="Random"/> + /// </summary> + private static readonly ThreadLocal<Random> threadRandom = new ThreadLocal<Random>(delegate { + lock (threadRandomInitializer) { + return new Random(threadRandomInitializer.Next()); + } + }); + + /// <summary> + /// Gets a random number generator for use on the current thread only. + /// </summary> + public static Random RandomNumberGenerator { + get { return threadRandom.Value; } + } + } + + /// <summary> /// A class to convert a <see cref="Comparison<T>"/> into an <see cref="IComparer<T>"/>. /// </summary> /// <typeparam name="T">The type of objects being compared.</typeparam> @@ -2048,31 +2074,5 @@ namespace DotNetOpenAuth.Messaging { #endregion } - - /// <summary> - /// A thread-safe, non-crypto random number generator. - /// </summary> - private static class ThreadSafeRandom { - /// <summary> - /// The initializer of all new <see cref="Random"/> instances. - /// </summary> - private static readonly Random threadRandomInitializer = new Random(); - - /// <summary> - /// A thread-local instance of <see cref="Random"/> - /// </summary> - private static readonly ThreadLocal<Random> threadRandom = new ThreadLocal<Random>(delegate { - lock (threadRandomInitializer) { - return new Random(threadRandomInitializer.Next()); - } - }); - - /// <summary> - /// Gets a random number generator for use on the current thread only. - /// </summary> - public static Random RandomNumberGenerator { - get { return threadRandom.Value; } - } - } } } diff --git a/src/DotNetOpenAuth.Test/Mocks/CoordinatingHttpRequestInfo.cs b/src/DotNetOpenAuth.Test/Mocks/CoordinatingHttpRequestInfo.cs index d53d8c9..2713765 100644 --- a/src/DotNetOpenAuth.Test/Mocks/CoordinatingHttpRequestInfo.cs +++ b/src/DotNetOpenAuth.Test/Mocks/CoordinatingHttpRequestInfo.cs @@ -32,6 +32,7 @@ namespace DotNetOpenAuth.Test.Mocks { /// <param name="messageFactory">The message factory.</param> /// <param name="messageData">The message data.</param> /// <param name="recipient">The recipient.</param> + /// <param name="cookies">Cookies included in the incoming request.</param> internal CoordinatingHttpRequestInfo( Channel channel, IMessageFactory messageFactory, @@ -52,6 +53,7 @@ namespace DotNetOpenAuth.Test.Mocks { /// that will not generate any message. /// </summary> /// <param name="recipient">The recipient.</param> + /// <param name="cookies">Cookies included in the incoming request.</param> internal CoordinatingHttpRequestInfo(MessageReceivingEndpoint recipient, HttpCookieCollection cookies) : base(GetHttpVerb(recipient), recipient != null ? recipient.Location : new Uri("http://host/path"), cookies: cookies) { this.recipient = recipient; diff --git a/src/DotNetOpenAuth.Test/Mocks/CoordinatingOutgoingWebResponse.cs b/src/DotNetOpenAuth.Test/Mocks/CoordinatingOutgoingWebResponse.cs index 326cc74..90dbd7d 100644 --- a/src/DotNetOpenAuth.Test/Mocks/CoordinatingOutgoingWebResponse.cs +++ b/src/DotNetOpenAuth.Test/Mocks/CoordinatingOutgoingWebResponse.cs @@ -23,6 +23,7 @@ namespace DotNetOpenAuth.Test.Mocks { /// </summary> /// <param name="message">The direct response message to send to the remote channel. This message will be cloned.</param> /// <param name="receivingChannel">The receiving channel.</param> + /// <param name="sendingChannel">The sending channel.</param> internal CoordinatingOutgoingWebResponse(IProtocolMessage message, CoordinatingChannel receivingChannel, CoordinatingChannel sendingChannel) { Requires.NotNull(message, "message"); Requires.NotNull(receivingChannel, "receivingChannel"); |