Beispiel #1
0
        public void Two_Number_Length_Both_Right()
        {
            // Arrange
            var solution = new FindFirstAndLastPositionOfElementInSortedArraySolution();
            var expected = new int[] { 0, 1 };

            //act
            var result = solution.SearchRange(new int[] { 1, 1 }, 1);

            //Assert
            Assert.Equal(expected, result);
        }
Beispiel #2
0
        public void Not_Found_In_Small_Array()
        {
            // Arrange
            var solution = new FindFirstAndLastPositionOfElementInSortedArraySolution();
            var expected = new int[] { -1, -1 };

            //act
            var result = solution.SearchRange(new int[] { 2, 2 }, 6);

            //Assert
            Assert.Equal(expected, result);
        }
Beispiel #3
0
        public void Common_Test()
        {
            // Arrange
            var solution = new FindFirstAndLastPositionOfElementInSortedArraySolution();
            var expected = new int[] { 3, 4 };

            //act
            var result = solution.SearchRange(new int[] { 5, 7, 7, 8, 8, 10 }, 8);


            //Assert
            Assert.Equal(expected, result);
        }