diff --git a/Source/Collections/MultiDictionary.Interfaces.cs b/Source/Collections/MultiDictionary.Interfaces.cs index c5b0794..86c1a1e 100644 --- a/Source/Collections/MultiDictionary.Interfaces.cs +++ b/Source/Collections/MultiDictionary.Interfaces.cs @@ -241,6 +241,13 @@ namespace Nuclex.Support.Collections { return this.typedDictionary.GetEnumerator(); } + /// Removes the specified key/value pair from the dictionary + /// Key/value pair that will be removed + /// True if the key/value pair was contained in the dictionary + int ICollection>>.Count { + get { return this.typedDictionary.Count; } + } + #endregion // ICollection>> implementation } diff --git a/Source/Collections/MultiDictionary.Test.cs b/Source/Collections/MultiDictionary.Test.cs index 15a1fa4..19310bc 100644 --- a/Source/Collections/MultiDictionary.Test.cs +++ b/Source/Collections/MultiDictionary.Test.cs @@ -139,6 +139,21 @@ namespace Nuclex.Support.Collections { ); } + /// + /// 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 + /// + [Test] + public void CollectionOfCollectionCountIsUniqueKeyCount() { + var dictionary = new MultiDictionary(); + dictionary.Add(10, "ten"); + dictionary.Add(10, "zehn"); + + Assert.AreEqual(2, dictionary.Count); + var collectionOfCollections = (ICollection>>)dictionary; + Assert.AreEqual(1, collectionOfCollections.Count); + } + } } // namespace Nuclex.Support.Collections