Пример #1
0
        public void SortOnKeysTest()
        {
            IDictionary<double, double> dictionary = new Dictionary<double, double>
            {
                { -5F, 1F },
                { -2F, 0.2F },
                { -7F, 0.4F },
                { 10F, 1F }
            };

            var expected = new SortedDictionary<double, double>
            {
                { -5F, 1F },
                { -2F, 0.2F },
                { -7F, 0.4F },
                { 10F, 1F }
            };

            SortedDictionary<double, double> actual = dictionary.SortOnKeys();
            foreach (double key in actual.Keys)
            {
                Assert.That(actual[key], Is.EqualTo(expected[key]).Within(1).Percent);
            }
        }