public void SearchLastNumberTest() { // Arrange int[] sortedArray = Enumerable.Range(-500000, 1000001).ToArray(); int number = 500000; RecursiveDynamicBinarySearch recursiveDynamicBinarySearch = new RecursiveDynamicBinarySearch(); int expectedResult = 1000000; // Act (1 Zeile!) int result = recursiveDynamicBinarySearch.Search(number, sortedArray); // Assert rückgabe vom Act soll überprüft werden Assert.AreEqual(expectedResult, result); }
public void SearchRandomNumberTest2() { // Arrange int[] sortedArray = Enumerable.Range(-500000, 1000001).ToArray(); Random rnd = new Random(); int number = rnd.Next(-499999, 1000000); RecursiveDynamicBinarySearch recursiveDynamicBinarySearch = new RecursiveDynamicBinarySearch(); List <int> list = sortedArray.ToList(); int expectedResult = list.IndexOf(number); // Act (1 Zeile!) int result = recursiveDynamicBinarySearch.Search(number, sortedArray); // Assert rückgabe vom Act soll überprüft werden Assert.AreEqual(expectedResult, result); }