Created
August 4, 2010 12:44
-
-
Save kkozmic/508073 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Test] | |
public void Dictionary_enumerates_from_oldest_to_latest() | |
{ | |
var expected1 = new[] { 1, 2, 4, 3 }; | |
var dictionary1 = new Dictionary<int, object>(); | |
foreach (var key in expected1) | |
{ | |
dictionary1[key] = new object(); | |
} | |
var index = 0; | |
foreach (KeyValuePair<int, object> keyValuePair in dictionary1) | |
{ | |
Assert.AreEqual(expected1[index], keyValuePair.Key); | |
index++; | |
} | |
var expected2 = new[] { 4, 1, 2, 3 }; | |
var dictionary2 = new Dictionary<int, object>(); | |
foreach (var key in expected2) | |
{ | |
dictionary2[key] = new object(); | |
} | |
index = 0; | |
foreach (KeyValuePair<int, object> keyValuePair in dictionary2) | |
{ | |
Assert.AreEqual(expected2[index], keyValuePair.Key); | |
index++; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment