Beispiel #1
0
        static void Main(string[] args)
        {
            // \n is a newline
            // \t is a tab space
            const string HelpMessage = "###Wordscapes Cheater###\n\n" +
                                       "Returns matching words based on the characters you provide.\n\n" +
                                       "wsc characters\n\n  characters  The characters that Wordscapes gives you.\n\n" +
                                       "Example:\nwsc cat\nact\ncat";

            if (ArgsNeedsHelp(args))
            {
                Console.WriteLine(HelpMessage);
                return;
            }

            //We can use the other args for other stuff later
            //e.g. word count or letter position
            string        characterSet = args[0];
            List <string> dictionary   = CheatFunctions.GetDictionary();

            PrintMatchingWords(CheatFunctions.BuildMatchingWordsArray(characterSet, dictionary));
        }
Beispiel #2
0
 public void TestIfMatching_PassValidArray_Succeed(string givenLetters, string wordInDictionary)
 {
     int[] givenLettersArray = CheatFunctions.BuildOccurenceArray(givenLetters);
     int[] wordArray         = CheatFunctions.BuildOccurenceArray(wordInDictionary);
     Assert.IsTrue(CheatFunctions.TestIfMatching(givenLettersArray, wordArray));
 }
Beispiel #3
0
 public void BuildMatchingWordsArray_ValidString_Succeed(string input, string stringResult)
 {
     string[] expectedResult = stringResult.Split(';').ToArray();
     string[] arrayResult    = CheatFunctions.BuildMatchingWordsArray(input, CheatFunctions.GetDictionary());
     CollectionAssert.AreEquivalent(arrayResult, expectedResult);
 }
Beispiel #4
0
 public void BuildOccurenceArray_PassValidString_Succeed(string input, int[] expected)
 {
     CollectionAssert.AreEqual(expected, CheatFunctions.BuildOccurenceArray(input));
 }