Fixed failing unit tests on Mono; used CollectionAssert.AreEquivalent() instead of CollectionAssert.AreEqual() since the order of items in a Dictionary is unspecified and Mono makes use of this allowance; fixed one serious bug that should have been caught by the .NET 2.0 unit tests: the enumeration of ReadOnlyDictionary via ICollection should return DictionaryEntry[] and not KeyValuePair<>[]
git-svn-id: file:///srv/devel/repo-conversion/nusu@115 d2e56fa2-650e-0410-a79f-9358c0239efd
This commit is contained in:
parent
8dc15e8515
commit
2ab3b22c60
|
@ -281,7 +281,7 @@ namespace Nuclex.Support.Collections {
|
|||
(outputNumbers as IDictionary).Add(entry.Key, entry.Value);
|
||||
}
|
||||
|
||||
CollectionAssert.AreEqual(numbers, outputNumbers);
|
||||
CollectionAssert.AreEquivalent(numbers, outputNumbers);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -409,9 +409,16 @@ namespace Nuclex.Support.Collections {
|
|||
Dictionary<int, string> numbers = createTestDictionary();
|
||||
ReadOnlyDictionary<int, string> testDictionary = makeReadOnly(numbers);
|
||||
|
||||
DictionaryEntry[] entries = new DictionaryEntry[numbers.Count];
|
||||
(testDictionary as ICollection).CopyTo(entries, 0);
|
||||
|
||||
KeyValuePair<int, string>[] items = new KeyValuePair<int, string>[numbers.Count];
|
||||
(testDictionary as ICollection).CopyTo(items, 0);
|
||||
CollectionAssert.AreEqual(numbers, items);
|
||||
for(int index = 0; index < entries.Length; ++index) {
|
||||
items[index] = new KeyValuePair<int, string>(
|
||||
(int)entries[index].Key, (string)entries[index].Value
|
||||
);
|
||||
}
|
||||
CollectionAssert.AreEquivalent(numbers, items);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -444,7 +451,7 @@ namespace Nuclex.Support.Collections {
|
|||
memory.Position = 0;
|
||||
object testDictionary2 = formatter.Deserialize(memory);
|
||||
|
||||
CollectionAssert.AreEqual(testDictionary1, (IEnumerable)testDictionary2);
|
||||
CollectionAssert.AreEquivalent(testDictionary1, (IEnumerable)testDictionary2);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user