The Count property of the multi dictionary now returns either the value count of the number of unique keys depending on which interface it is called from
git-svn-id: file:///srv/devel/repo-conversion/nusu@259 d2e56fa2-650e-0410-a79f-9358c0239efd
This commit is contained in:
parent
ca373846aa
commit
0195b34289
|
@ -241,6 +241,13 @@ namespace Nuclex.Support.Collections {
|
|||
return this.typedDictionary.GetEnumerator();
|
||||
}
|
||||
|
||||
/// <summary>Removes the specified key/value pair from the dictionary</summary>
|
||||
/// <param name="item">Key/value pair that will be removed</param>
|
||||
/// <returns>True if the key/value pair was contained in the dictionary</returns>
|
||||
int ICollection<KeyValuePair<TKey, ICollection<TValue>>>.Count {
|
||||
get { return this.typedDictionary.Count; }
|
||||
}
|
||||
|
||||
#endregion // ICollection<KeyValuePair<TKey, ICollection<TValue>>> implementation
|
||||
|
||||
}
|
||||
|
|
|
@ -139,6 +139,21 @@ namespace Nuclex.Support.Collections {
|
|||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies that the Count property returns the number of unique keys if it is called
|
||||
/// on the collection-of-collections interface implemented by the multi dictionary
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void CollectionOfCollectionCountIsUniqueKeyCount() {
|
||||
var dictionary = new MultiDictionary<int, string>();
|
||||
dictionary.Add(10, "ten");
|
||||
dictionary.Add(10, "zehn");
|
||||
|
||||
Assert.AreEqual(2, dictionary.Count);
|
||||
var collectionOfCollections = (ICollection<KeyValuePair<int, ICollection<string>>>)dictionary;
|
||||
Assert.AreEqual(1, collectionOfCollections.Count);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} // namespace Nuclex.Support.Collections
|
||||
|
|
Loading…
Reference in New Issue
Block a user