public void test_solution_givenArrayOfInterer_returnsNumberOfDistinctElements(int[] given, int expected)
        {
            var target = new Distinct();
            var actual = target.solution(given);

            Assert.AreEqual(expected, actual);
        }
Example #2
0
        public void Distinct_Should_Hanlde_Empty_Array()
        {
            Distinct subject = new Distinct();

            int[] array = { };

            int result = subject.solution(array);

            Assert.Equal(0, result);
        }
Example #3
0
        public void Distinct_Should_Process_Simple_Array()
        {
            Distinct subject = new Distinct();

            int[] array = { 2, 1, 1, 2, 3, 1 };

            int result = subject.solution(array);

            Assert.Equal(3, result);
        }
Example #4
0
        public void Distinct_Should_Process_Complex_Array()
        {
            Distinct subject = new Distinct();

            int[] array = { 2, 1, 1, 2, 3, 1, 2, 1, 1, 2, 3, 1, 2, 1, 1, 2, 3, 1,
                            5, 7, 8, 3, 2, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 6, 7 };

            int result = subject.solution(array);

            Assert.Equal(10, result);
        }
Example #5
0
        public void Case01()
        {
            // Arrange
            var algorithm = new Distinct();
            var A         = new int[] { 2, 1, 1, 2, 3, 1 };

            // Act
            var result   = algorithm.solution(A);
            var expected = 3;

            // Assert
            Assert.Equal(expected, result);
        }
Example #6
0
        public void DistinctTest_01()
        {
            var solution = dst.solution(new int[] { 2, 1, 1, 2, 3, 1 });

            Assert.AreEqual(3, solution);
        }