diff options
Diffstat (limited to 'src')
4 files changed, 32 insertions, 14 deletions
diff --git a/src/DotNetOpenAuth/Messaging/MessagingUtilities.cs b/src/DotNetOpenAuth/Messaging/MessagingUtilities.cs index e303344..18b06e1 100644 --- a/src/DotNetOpenAuth/Messaging/MessagingUtilities.cs +++ b/src/DotNetOpenAuth/Messaging/MessagingUtilities.cs @@ -268,7 +268,7 @@ namespace DotNetOpenAuth.Messaging { } /// <summary> - /// Tests whether two arrays are equal in length and contents. + /// Tests whether two arrays are equal in contents and ordering. /// </summary> /// <typeparam name="T">The type of elements in the arrays.</typeparam> /// <param name="first">The first array in the comparison. May not be null.</param> @@ -329,6 +329,34 @@ namespace DotNetOpenAuth.Messaging { } /// <summary> + /// Tests two unordered collections for same contents. + /// </summary> + /// <typeparam name="T">The type of elements in the collections.</typeparam> + /// <param name="first">The first collection in the comparison. May not be null.</param> + /// <param name="second">The second collection in the comparison. May not be null.</param> + /// <returns>True if the collections have the same contents; false otherwise.</returns> + internal static bool AreEquivalentUnordered<T>(ICollection<T> first, ICollection<T> second) { + if (first == null && second == null) { + return true; + } + if ((first == null) ^ (second == null)) { + return false; + } + + if (first.Count != second.Count) { + return false; + } + + foreach (T value in first) { + if (!second.Contains(value)) { + return false; + } + } + + return true; + } + + /// <summary> /// Tests whether two dictionaries are equal in length and contents. /// </summary> /// <typeparam name="TKey">The type of keys in the dictionaries.</typeparam> diff --git a/src/DotNetOpenAuth/OpenId/Association.cs b/src/DotNetOpenAuth/OpenId/Association.cs index de25c88..562826b 100644 --- a/src/DotNetOpenAuth/OpenId/Association.cs +++ b/src/DotNetOpenAuth/OpenId/Association.cs @@ -6,17 +6,13 @@ namespace DotNetOpenAuth.OpenId { using System; - using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.IO; - using System.Linq; using System.Security.Cryptography; using System.Text; - using DotNetOpenAuth.Messaging; - using DotNetOpenAuth.OpenId.ChannelElements; - using DotNetOpenAuth.OpenId.Messages; using DotNetOpenAuth.Configuration; + using DotNetOpenAuth.Messaging; /// <summary> /// Stores a secret used in signing and verifying messages. diff --git a/src/DotNetOpenAuth/OpenId/Provider/StandardProviderApplicationStore.cs b/src/DotNetOpenAuth/OpenId/Provider/StandardProviderApplicationStore.cs index 1763782..3d9e15a 100644 --- a/src/DotNetOpenAuth/OpenId/Provider/StandardProviderApplicationStore.cs +++ b/src/DotNetOpenAuth/OpenId/Provider/StandardProviderApplicationStore.cs @@ -6,11 +6,8 @@ namespace DotNetOpenAuth.OpenId.Provider { using System; - using System.Collections.Generic; - using System.Linq; - using System.Text; - using DotNetOpenAuth.Messaging.Bindings; using DotNetOpenAuth.Configuration; + using DotNetOpenAuth.Messaging.Bindings; /// <summary> /// An in-memory store for Providers, suitable for single server, single process diff --git a/src/DotNetOpenAuth/OpenId/RelyingParty/StandardRelyingPartyApplicationStore.cs b/src/DotNetOpenAuth/OpenId/RelyingParty/StandardRelyingPartyApplicationStore.cs index 682568c..573c77c 100644 --- a/src/DotNetOpenAuth/OpenId/RelyingParty/StandardRelyingPartyApplicationStore.cs +++ b/src/DotNetOpenAuth/OpenId/RelyingParty/StandardRelyingPartyApplicationStore.cs @@ -6,12 +6,9 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { using System; - using System.Collections.Generic; - using System.Linq; - using System.Text; + using DotNetOpenAuth.Configuration; using DotNetOpenAuth.Messaging.Bindings; using DotNetOpenAuth.OpenId.ChannelElements; - using DotNetOpenAuth.Configuration; /// <summary> /// An in-memory store for Relying Parties, suitable for single server, single process |