OpenTween.LRUCacheDictionaryTest.CacheRemovedEventTest C# (CSharp) Method

CacheRemovedEventTest() private method

private CacheRemovedEventTest ( ) : void
return void
        public void CacheRemovedEventTest()
        {
            var dict = new LRUCacheDictionary<string, string>();

            dict["key1"] = "value1";
            dict["key2"] = "value2";
            dict["key3"] = "value3";
            dict["key4"] = "value4";

            // イベント設定
            var removedList = new List<string>();
            dict.CacheRemoved += (s, e) =>
            {
                removedList.Add(e.Item.Key);
            };

            // 2 個までに縮小
            dict.TrimLimit = 2;
            dict.Trim();

            // 直近に参照された 3, 4 以外のアイテムに対してイベントが発生しているはず
            Assert.Equal<IEnumerable<string>>(new[] { "key1", "key2" }, removedList, collComparer);
        }