Exemplo n.º 1
0
        public void ReturnExpectedIndexes(int[] nums, int target, int[] expected)
        {
            var problem = new TwoSumProblem();
            var result  = problem.TwoSum(nums, target);

            Assert.Equal(expected, result);
        }
Exemplo n.º 2
0
        public void CorrectnessTest(int [] nums, int target, int [] expected)
        {
            var solution = new TwoSumProblem();

            var result = solution.TwoSum(nums, target);

            CollectionAssert.AreEquivalent(expected, result);
        }
Exemplo n.º 3
0
        public void TwoSumTest_Case1()
        {
            // Arrange
            TwoSumProblem obj = new TwoSumProblem();

            int[] nums     = new int[] { 2, 7, 11, 15 };
            int   target   = 9;
            var   expected = new int[] { 0, 1 };

            // Act
            var actual = obj.TwoSum(nums, target);

            // Assert
            Assert.Equal(expected, actual);
        }
Exemplo n.º 4
0
        public void TwoSumTest_Case5()
        {
            // Arrange
            TwoSumProblem obj = new TwoSumProblem();

            int[] nums   = new int[] { -10, -1, -18, -19 };
            int   target = -19;

            int[] expected = new int[] { 1, 2 };

            // Act
            var actual = obj.TwoSum(nums, target);

            // Assert
            Assert.Equal(expected, actual);
        }
Exemplo n.º 5
0
        public void TwoSumTest_Case4()
        {
            // Arrange
            TwoSumProblem obj = new TwoSumProblem();

            int[] nums   = new int[] { -3, 4, 3, 90 };
            int   target = 0;

            int[] expected = new int[] { 0, 2 };

            // Act
            var actual = obj.TwoSum(nums, target);

            // Assert
            Assert.Equal(expected, actual);
        }
        public void Test1()
        {
            var result = TwoSumProblem.TwoSum(new int[] { 6, 1, -1, 5, -6 }, -7);

            result.ToList().Should().Contain(new int[] { 2, 4 });
        }
Exemplo n.º 7
0
 static void Main(string[] args)
 {
     var problem = new TwoSumProblem();
     var test    = problem.TwoSum(new int[] { 2, 7, 11, 15 }, 9);
 }