1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-08-15 22:31:40 +02:00

Add InnerValues property to TwoKeyDictionary

This commit is contained in:
2017-04-01 19:14:36 +02:00
parent 130159f06c
commit 51e2791cc7
2 changed files with 26 additions and 0 deletions

@@ -31,6 +31,16 @@ namespace TweetDck.Core.Utils{
}
}
public IEnumerable<V> InnerValues{
get{
foreach(Dictionary<K2, V> innerDict in dict.Values){
foreach(V value in innerDict.Values){
yield return value;
}
}
}
}
// Members
public void Add(K1 outerKey, K2 innerKey, V value){ // throws on duplicate

@@ -1,4 +1,5 @@
using System;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using TweetDck.Core.Utils;
using System.Collections.Generic;
@@ -65,6 +66,21 @@ namespace UnitTests.Core.Utils{
Assert.AreEqual("new key and entry", dict["xxxxx", 150]);
}
[TestMethod]
public void TestInnerValues(){
CollectionAssert.AreEqual(new string[]{
"x",
"y",
"z",
"test 1",
"test 2",
"test 3",
"test 4",
"",
""
}, CreateDict().InnerValues.ToList());
}
[TestMethod]
[ExpectedException(typeof(KeyNotFoundException))]
public void TestAccessorMissingKey1(){