Refactored the entire .config file supporting classes, and added a .config element...
[dotnetoauth.git] / src / DotNetOpenAuth.Test / Messaging / CollectionAssert.cs
blobf9e569ab27374740b30d488e0c91549ad9add2ce
1 //-----------------------------------------------------------------------
2 // <copyright file="CollectionAssert.cs" company="Andrew Arnott">
3 // Copyright (c) Andrew Arnott. All rights reserved.
4 // </copyright>
5 //-----------------------------------------------------------------------
7 namespace DotNetOpenAuth.Test.Messaging {
8 using System.Collections;
9 using System.Collections.Generic;
10 using System.Linq;
11 using DotNetOpenAuth.Messaging;
12 using Microsoft.VisualStudio.TestTools.UnitTesting;
14 internal class CollectionAssert<T> {
15 internal static void AreEquivalent(ICollection<T> expected, ICollection<T> actual) {
16 ErrorUtilities.VerifyArgumentNotNull(expected, "expected");
17 ErrorUtilities.VerifyArgumentNotNull(actual, "actual");
19 ICollection expectedNonGeneric = new List<T>(expected);
20 ICollection actualNonGeneric = new List<T>(actual);
21 CollectionAssert.AreEquivalent(expectedNonGeneric, actualNonGeneric);
24 internal static void AreEquivalentByEquality(ICollection<T> expected, ICollection<T> actual) {
25 ErrorUtilities.VerifyArgumentNotNull(expected, "expected");
26 ErrorUtilities.VerifyArgumentNotNull(actual, "actual");
28 Assert.AreEqual(expected.Count, actual.Count);
29 foreach (T value in expected) {
30 Assert.IsTrue(actual.Contains(value));
34 internal static void Contains(IEnumerable<T> sequence, T element) {
35 ErrorUtilities.VerifyArgumentNotNull(sequence, "sequence");
37 if (!sequence.Contains(element)) {
38 Assert.Fail("Sequence did not include expected element '{0}'.", element);