public void TestEmptyDictionary() { var dictionary = new TreeDictionary <int, int>(); TreeDictionary <int, int> .KeyCollection keys = dictionary.Keys; TreeDictionary <int, int> .ValueCollection values = dictionary.Values; Assert.Empty(dictionary); Assert.Empty(keys); Assert.Empty(values); #pragma warning disable xUnit2013 // Do not use equality check to check for collection size. Assert.Equal(0, dictionary.Count); Assert.Equal(0, keys.Count); Assert.Equal(0, values.Count); #pragma warning restore xUnit2013 // Do not use equality check to check for collection size. Assert.False(dictionary.ContainsKey(0)); Assert.False(dictionary.ContainsValue(0)); Assert.False(dictionary.TryGetValue(0, out _)); Assert.Throws <KeyNotFoundException>(() => dictionary[0]); #pragma warning disable xUnit2017 // Do not use Contains() to check if a value exists in a collection Assert.False(keys.Contains(0)); Assert.False(values.Contains(0)); #pragma warning restore xUnit2017 // Do not use Contains() to check if a value exists in a collection }