Пример #1
0
        public void BinarySearchTest()
        {
            var l = new EventedList <EClass>(100);
            var r = new Random();

            for (var i = 0; i < 100; i++)
            {
                l.Add(new EClass(r.Next()));
            }
            l.Sort();
            var x = l[27];

            Assert.That(l.BinarySearch(x), Is.EqualTo(27));
            Assert.That(l.BinarySearch(x, new CEClass()), Is.EqualTo(27));
            Assert.That(l.BinarySearch(10, 40, x, new CEClass()), Is.EqualTo(27));
            Assert.That(l.BinarySearch(50, 40, x, new CEClass()), Is.Negative);
        }