Esempio n. 1
0
        public void Chaining_Dictionary()
        {
            var dict = new System.Collections.Generic.Dictionary <int, int> {
                [1] = 2, [3] = 4
            };
            var sortedDict = new System.Collections.Generic.SortedDictionary <int, int> {
                [1] = 2, [3] = 4
            };

            Assert.IsTrue(dict.SequenceEqual(dict.DefaultIfEmpty()));
            Assert.IsTrue(dict.SequenceEqual(dict.DefaultIfEmpty(dict.First())));
            Assert.IsTrue(sortedDict.SequenceEqual(sortedDict.DefaultIfEmpty()));
            Assert.IsTrue(sortedDict.SequenceEqual(sortedDict.DefaultIfEmpty(sortedDict.First())));
        }