Esempio n. 1
0
        public void AnagramArgument_Failed()
        {
            string str1 = "";
            string str2 = null;

            AnagramLibs.Anagram(str1);
            AnagramLibs.Anagram(str2);
        }
Esempio n. 2
0
        public void Anagram_Failed()
        {
            string word1 = "abcd";

            string[] definedResult1 = new[]
            {
                "abdc",
                "adbc",
                "dabc",
                "dacb",
                "dcab",
                "cdab",
                "cdba",
                "cbda",
                "bcda",
                "bcad",
                "bacd",
                "abcd",
                "abcd" //same word will cause a failure
            };
            string word2 = "abcde";

            string[] definedResult2 = new[]
            {
                "abced",
                "abecd",
                "aebcd",
                "eabcd",
                "eabdc",
                "eadbc",
                "edabc",
                "deabc",
                "deacb",
                "decab",
                "dceab",
                "cdeab",
                "cdeba",
                "cdbea",
                "cbdea",
                "bcdea",
                "bcdae",
                "bcade",
                "bacde",
                "abcde",
                "abcde" //same word will cause a failure
            };
            //1st Test...
            string[] actualResult1 = AnagramLibs.Anagram(word1);
            CollectionAssert.AreNotEqual(actualResult1, definedResult1);
            //2nd Test...
            string[] actualResult2 = AnagramLibs.Anagram(word2);
            CollectionAssert.AreNotEqual(actualResult2, definedResult2);
        }