public static void Main()
    {
        Console.Write("Enter the password --> ");
        string  password = Console.ReadLine();
        Permute perm     = new Permute();

        Console.Write("It takes {0} seconds.\n", perm.GetSeconds(perm.GetPermutations(password), 500000));
    }
예제 #2
0
        public void GetPermutationsTest()
        {
            List <string> list = new List <string> {
                "1", "2", "3", "4", "5"
            };


            IEnumerable <IEnumerable <string> > tmp = Permute.GetPermutations(list, list.Count);

            foreach (IEnumerable <string> s in tmp)
            {
                Console.WriteLine(s.ToList());
            }

            int expected = 120;
            int result   = tmp.Count();

            Assert.AreEqual(expected, result);
        }