Пример #1
0
        public void SingleWordCheckTest()
        {
            SecretWordManager actual = new SecretWordManager();
            actual.LoadAllSecretWords(@"../../Test Resources/SecretWordLibraryTest.txt");

            Assert.IsTrue(actual.GetAllSecretWords().Contains("computer"));
        }
Пример #2
0
        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());
        }
Пример #3
0
        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());
        }
Пример #4
0
        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());
        }
Пример #5
0
 public void PathTooLongExceptionTest()
 {
     SecretWordManager invalidPath = new SecretWordManager();
     invalidPath.LoadAllSecretWords(@"../../Test Resources/WordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTestWordLibraryTest.txt");
 }
Пример #6
0
 public void LoadingWordLibraryFileNotFoundTest()
 {
     SecretWordManager invalidPath = new SecretWordManager();
     invalidPath.LoadAllSecretWords(@"../../Test Resources/WordLibraryTest.txt");
 }
Пример #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;
        }