Example #1
0
        public void LinearSearchTest()
        {
            // Arrange
            var data            = ArrayHelpers.CreateUnsortedArray();
            var searchAlgorithm = new ArraySearch();

            // Act
            var result = searchAlgorithm.LinearSearch(data, 9);

            // Assert
            result.Should().BeTrue();
        }
Example #2
0
        public void BinarySearchTest()
        {
            // Arrange
            var data            = ArrayHelpers.CreateUnsortedArray();
            var sortAlgorithm   = new QuickSort <int>();
            var searchAlgorithm = new ArraySearch();

            data = sortAlgorithm.Sort(data);

            // Act
            var result = searchAlgorithm.BinarySearch(data, 9);

            // Assert
            result.Should().BeTrue();
        }