예제 #1
0
        public void AbdulsAlgorithm()
        {
            var abdulResult =
                Permutations.AbdulsAlgorithm(
                    new List <List <object> >()
            {
                new List <object>()
                {
                    "1", "2"
                },
                new List <object>()
                {
                    "1", "2", "3"
                },
                new List <object>()
                {
                    "1", "2"
                }
            });
            var results = abdulResult.Select(x => string.Join(',', x)).ToList();

            Assert.True(results.Distinct().Count() == results.Count);
            Assert.Equal(12, results.Count);
            Assert.Contains("1,1,1", results);
        }
예제 #2
0
        public void AbdulsAlgorithm_AllCombinationsTest(string combinationAsString)
        {
            var abdulResult =
                Permutations.AbdulsAlgorithm(
                    new List <List <object> >()
            {
                new List <object>()
                {
                    "1", "2"
                },
                new List <object>()
                {
                    "1", "2", "3"
                },
                new List <object>()
                {
                    "1", "2"
                }
            });
            var results = abdulResult.Select(x => string.Join(',', x)).ToList();

            Assert.Contains(combinationAsString, results);
        }