Пример #1
0
        public void Execute()
        {
            Console.WriteLine($"\n{nameof(Two_Sum_Test)}");
            int[] arr    = { 2, 7, 11, 34, 3, 2 };
            int   target = 9;

            int[] result = new Two_Sum().TwoSum(arr, target);
            Console.WriteLine($"Input array: {String.Join(", ", arr)}, target: {target.ToString()}");
            Console.WriteLine($"Result: {String.Join(", ", result)}");
        }
Пример #2
0
        public void TwoSumTestTest_input_2_7_11_15_output_9()
        {
            ////arrange
            Two_Sum solution = new Two_Sum();

            int[] array  = new int[] { 2, 7, 11, 15 };
            int   target = 9;

            ////act
            int[] result = solution.GetSolution(array, target);

            ////assert
            Assert.IsTrue(result.Contains(0));
            Assert.IsTrue(result.Contains(1));
        }