예제 #1
0
        public void FindIntValue_ReturnsNull_IfListIsEmpty()
        {
            var emptyList = new List <int>();

            var result = BinarySearchFunctions.FindIntValue(emptyList, 0);

            Assert.IsNull(result);
        }
예제 #2
0
        public void FindIntValue_ReturnsNull_IfValueNotFound()
        {
            var testList = new List <int> {
                0, 1, 2, 3, 4, 5
            };

            var result = BinarySearchFunctions.FindIntValue(testList, 9);

            Assert.IsNull(result);
        }
예제 #3
0
        public void FindIntValue_ReturnsValue_IfValueFound()
        {
            var testList = new List <int> {
                0, 1, 2, 3, 4, 5
            };
            var searchValue = 3;

            var result = BinarySearchFunctions.FindIntValue(testList, searchValue);

            Assert.AreEqual(searchValue, result);
        }
예제 #4
0
        public void FindIntValue_ThrowsException_IfArrayIsNull()
        {
            List <int> nullList = null;

            Assert.That(() => BinarySearchFunctions.FindIntValue(nullList, 0), Throws.ArgumentNullException);
        }