Ejemplo n.º 1
0
        public void SumPositiveAndNegative_CountPositivesSumNegatives_RandomTests()
        {
            for (int i = 0; i < 20; i++)
            {
                int   elementsNumber = random.Next(0, 100);
                int[] input          = new int[elementsNumber];
                for (int j = 0; j < elementsNumber; j++)
                {
                    input[j] = random.Next(-500, 500);
                }

                Assert.AreEqual(CountPositivesSumNegatives(input), SumPositiveAndNegative.CountPositivesSumNegatives(input));
            }
        }
Ejemplo n.º 2
0
        public void SumPositiveAndNegative_CountPositivesSumNegatives_InputWithZeroes()
        {
            int[] expectedResult = new int[] { 8, -50 };

            Assert.AreEqual(expectedResult, SumPositiveAndNegative.CountPositivesSumNegatives(new[] { 0, 2, 3, 0, 5, 6, 7, 8, 9, 10, -11, -12, -13, -14 }));
        }
Ejemplo n.º 3
0
        public void SumPositiveAndNegative_CountPositivesSumNegatives_InputEmpty()
        {
            int[] expectedResult = new int[] { };

            Assert.AreEqual(expectedResult, SumPositiveAndNegative.CountPositivesSumNegatives(new int[] { }));
        }
Ejemplo n.º 4
0
        public void SumPositiveAndNegative_CountPositivesSumNegatives_BasicTest()
        {
            int[] expectedResult = new int[] { 10, -65 };

            Assert.AreEqual(expectedResult, SumPositiveAndNegative.CountPositivesSumNegatives(new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -11, -12, -13, -14, -15 }));
        }