public void SingleWordCheckTest()
        {
            SecretWordManager actual = new SecretWordManager();
            actual.LoadAllSecretWords(@"../../Test Resources/SecretWordLibraryTest.txt");

            Assert.IsTrue(actual.GetAllSecretWords().Contains("computer"));
        }
        public void LoadingWordsFromTest()
        {
            List<string> expected = new List<string> { "computer", "programmer", "software", "debugger", "compiler", "developer" };

            SecretWordManager actual = new SecretWordManager();
            actual.LoadAllSecretWords(@"../../Test Resources/SecretWordLibraryTest.txt");

            Assert.AreEqual(expected.ToString(), actual.GetAllSecretWords().ToString());
        }
        public void LoadingWordsFromNonOrderedFileWithWordsTest()
        {
            List<string> expected = new List<string> { "computer", "debugger", "silence" };

            SecretWordManager actual = new SecretWordManager();
            actual.LoadAllSecretWords(@"../../Test Resources/nonOrderedWords.txt");

            Assert.AreEqual(expected.ToString(), actual.GetAllSecretWords().ToString());
        }
        public void LoadingWordsFromEmptyFileTest()
        {
            List<string> expected = new List<string>();

            SecretWordManager actual = new SecretWordManager();
            actual.LoadAllSecretWords(@"../../Test Resources/emptyfile.txt");

            Assert.AreEqual(expected.ToString(), actual.GetAllSecretWords().ToString());
        }
 public void PathTooLongExceptionTest()
 {
     SecretWordManager invalidPath = new SecretWordManager();
     invalidPath.LoadAllSecretWords(@"../../Test Resources/WordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTest.txt");
 }
 public void LoadingWordLibraryFileNotFoundTest()
 {
     SecretWordManager invalidPath = new SecretWordManager();
     invalidPath.LoadAllSecretWords(@"../../Test Resources/WordLibraryTest.txt");
 }
Example #7
0
        /// <summary>
        /// Loads the secret word through the selected choice strategy.
        /// </summary>
        private IWord LoadSecretWord()
        {
            SecretWordManager wordsManager = new SecretWordManager();
            wordsManager.LoadAllSecretWords(this.PathToSecretWordsDirectory);

            List<string> allWords = wordsManager.GetAllSecretWords();
            IWord secretWord = new ProxyWord(this.ChoiceWord(this.ChoiceStrategy, allWords));
            this.CheckManager.DefineCommands(secretWord);
            UIMessages.WelcomeMessage(MaxPlayerAttempts);

            return secretWord;
        }