Beispiel #1
0
 public void NegativeTests()
 {
     Assert.Throws <ArgumentNullException>(() => BinarySearchClass <int> .FindNumber(ints, 3, null));
     Assert.Throws <ArgumentNullException>(() => BinarySearchClass <int> .FindNumber(null, 3, new Comparators()));
     Assert.Throws <ArgumentNullException>(() => BinarySearchClass <int> .FindNumber(new List <int> {
     }, 3, new Comparators()));
 }
Beispiel #2
0
        public void PositiveTests()
        {
            int actual = BinarySearchClass <double> .FindNumber(doubles, 2.45, new Comparators());

            int expected = 1;

            Assert.AreEqual(expected, actual);

            actual = BinarySearchClass <int> .FindNumber(ints, 3, new Comparators());

            expected = 2;
            Assert.AreEqual(expected, actual);

            actual = BinarySearchClass <string> .FindNumber(strings, "w", new Comparators());

            expected = 4;
            Assert.AreEqual(expected, actual);
        }