Пример #1
0
        public void MyTestMethod1()
        {
            //Arrange
            var input    = new[] { 10, 1, 2, 7, 6, 1, 5 };
            var target   = 8;
            var expected = new List <List <int> >
            {
                new List <int> {
                    1, 7
                },
                new List <int> {
                    1, 2, 5
                },
                new List <int> {
                    2, 6
                },
                new List <int> {
                    1, 1, 6
                }
            };

            //Act
            var solver = new CombinationSum2.Solution();
            var res    = solver.CombinationSum2(input, target);

            //Assert
            Assert.AreEqual(expected.Count, res.Count);
        }
Пример #2
0
        public void MyTestMethod2()
        {
            //Arrange
            var input    = new[] { 2, 5, 2, 1, 2 };
            var target   = 5;
            var expected = new List <List <int> >
            {
                new List <int> {
                    1, 2, 2
                },
                new List <int> {
                    5
                }
            };

            //Act
            var solver = new CombinationSum2.Solution();
            var res    = solver.CombinationSum2(input, target);

            //Assert
            Assert.AreEqual(expected.Count, res.Count);
        }