Пример #1
0
        public void FindByBruteForceTest(int sum, int[] arr)
        {
            // Arrange
            var expectedIndex1 = 1;
            var expectedIndex2 = 3;

            var findPair = new FindPair();

            // Act
            var pair = findPair.FindByBruteForce(sum, arr);

            // Assert
            Assert.Equal(expectedIndex1, pair.Index1);
            Assert.Equal(expectedIndex2, pair.Index2);
        }
Пример #2
0
        public void FindBySortingTest(int sum, int[] arr)
        {
            // Arrange
            // [1, 2, 3, 4, 5, 6, 7, 9, 10, 12]
            var expectedIndex1 = 2;
            var expectedIndex2 = 9;

            var findPair = new FindPair();

            // Act
            var pair = findPair.FindBySorting(sum, arr);

            // Assert
            Assert.Equal(expectedIndex1, pair.Index1);
            Assert.Equal(expectedIndex2, pair.Index2);
        }