public void GetPermutations2UseDictionaryCompleteTestsTestNullString()
        {
            var expected = new List <string>();
            var actual   = GetPermutations1NoDuplicatesByCharComplete.GetPermutations(null);

            CollectionAssert.AreEqual(expected, actual);
        }
コード例 #2
0
        public void GetPermutations1NoDuplicatesByCharCompleteTestsTestEmptyString()
        {
            var expected = new List <string>();
            var str      = string.Empty;
            var actual   = GetPermutations1NoDuplicatesByCharComplete.GetPermutations(str);

            CollectionAssert.AreEqual(expected, actual);
        }
        public void GetPermutations2UseDictionaryCompleteTestsTest1Char()
        {
            var expected = new List <string>()
            {
                "a"
            };
            var str    = "a";
            var actual = GetPermutations1NoDuplicatesByCharComplete.GetPermutations(str);

            CollectionAssert.AreEqual(expected, actual);
        }
        public void GetPermutations2UseDictionaryCompleteTestsTest4Char()
        {
            var expected = new List <string>()
            {
                "abcd", "abdc", "acbd", "acdb", "adbc", "adcb", "bacd", "badc", "bcad", "bcda", "bdac", "bdca", "cabd", "cadb", "cbad", "cbda", "cdab", "cdba", "dabc", "dacb", "dbac", "dbca", "dcab", "dcba"
            };
            var str    = "abcd";
            var actual = GetPermutations1NoDuplicatesByCharComplete.GetPermutations(str);

            // Sort the list so it will always match expected.
            // The algorithm itself doesn't guarantee any particular order.
            actual.Sort();
            CollectionAssert.AreEqual(expected, actual);
        }
コード例 #5
0
        public void GetPermutations1NoDuplicatesByCharCompleteTestsTest2Char()
        {
            var expected = new List <string>()
            {
                "ab", "ba"
            };
            var str    = "ab";
            var actual = GetPermutations1NoDuplicatesByCharComplete.GetPermutations(str);

            // Sort the list so it will always match expected.
            // The algorithm itself doesn't guarantee any particular order.
            actual.Sort();
            CollectionAssert.AreEqual(expected, actual);
        }