public void Test_SumOfDigits()
        {
            var exercise02 = new Exercise02();

            Assert.AreEqual(exercise02.SumOfDigits(2324142), 18);
            Assert.AreEqual(exercise02.SumOfDigits(8799), 33);
        }
        public void Exercise02_Test()
        {
            var input = new char[, ] {
                { ' ', ' ', ' ', 'x', ' ', ' ', ' ', 'x', ' ', ' ' },
                { ' ', ' ', 'x', ' ', ' ', 'x', ' ', ' ', ' ', 'x' },
                { ' ', 'x', ' ', ' ', ' ', 'x', 'x', 'x', 'x', ' ' },
                { ' ', ' ', ' ', 'x', ' ', 'x', ' ', 'x', ' ', ' ' },
                { ' ', ' ', ' ', ' ', ' ', 'x', 'x', 'x', ' ', 'x' },
                { ' ', 'x', ' ', ' ', 'x', 'x', 'x', ' ', ' ', ' ' }
            };

            var resultExpected = new char[, ] {
                { '0', '1', '2', 'x', '2', '1', '2', 'x', '2', '1' },
                { '1', '2', 'x', '2', '3', 'x', '5', '4', '4', 'x' },
                { '1', 'x', '3', '2', '4', 'x', 'x', 'x', 'x', '2' },
                { '1', '1', '2', 'x', '4', 'x', '8', 'x', '5', '2' },
                { '1', '1', '2', '2', '5', 'x', 'x', 'x', '3', 'x' },
                { '1', 'x', '1', '1', 'x', 'x', 'x', '3', '2', '1' }
            };

            var result = Exercise02.Minesweeper(input);

            Assert.Equal(result, resultExpected);
        }
Exemple #3
0
 public void Test_SumDigits_Ok(int a, int result)
 {
     Assert.AreEqual(Exercise02.SumDigits(a), result);
 }
Exemple #4
0
        public void Test_Exercise2(int a, int b, string expected)
        {
            var actualResult = Exercise02.Run(a, b);

            actualResult.Should().BeEquivalentTo(expected);
        }
Exemple #5
0
        public void Exercise02_Test(float resultExpected, string[] input)
        {
            var result = Exercise02.angles(input);

            Assert.Equal(resultExpected, result);
        }
Exemple #6
0
        public void Exercise02_Test(int[] resultExpected, int[] input)
        {
            var result = Exercise02.SumToZero(input);

            Assert.Equal(resultExpected, result);
        }
        public void TestNegativeValues()
        {
            var actualResult = Exercise02.Run(-3, -1);

            Assert.AreEqual("-3 -2 -1", actualResult);
        }
        public void TestFromPositiveToNegative()
        {
            var actualResult = Exercise02.Run(3, -1);

            Assert.AreEqual("3 2 1 0 -1", actualResult);
        }
        public void TestNormalValues()
        {
            var actualResult = Exercise02.Run(15, 20);

            Assert.AreEqual("15 16 17 18 19 20", actualResult);
        }
        public void TestFlippedValues()
        {
            var actualResult = Exercise02.Run(20, 15);

            Assert.AreEqual("20 19 18 17 16 15", actualResult);
        }
        public void TestEqualValues()
        {
            var actualResult = Exercise02.Run(10, 10);

            Assert.AreEqual("10", actualResult);
        }
Exemple #12
0
        public void Test_SnakeCaseToTitleCase()
        {
            var exercise02 = new Exercise02();

            Assert.AreEqual(exercise02.SnakeCaseToTitleCase("snake_case_"), "SnakeCase");
        }
Exemple #13
0
        public void Exercise02_Test(long[] resultExpected, long[] input)
        {
            var result = Exercise02.Track(input);

            Assert.Equal(resultExpected, result);
        }
Exemple #14
0
 public void SurroundWithTags()
 {
     Assert.AreEqual("<b>a</b>", Exercise02.SurroundWithTag("a", "b"));
     Assert.AreEqual("splendid", Exercise02.SurroundWithTag("splendid", null));
 }
        public void Test_MaxTripletSum()
        {
            var exercise02 = new Exercise02();

            Assert.AreEqual(exercise02.MaxTripletSum(new int[] { 12, 20, 40, 1, 5, 10, 30, 20 }), 90);
        }