Example #1
0
        public FileHelperTests()
        {
            _filename         = "test-dictionary.json";
            _filenameToCreate = "created-new-file.json";

            TestFileHelper.Create(_filename);
        }
Example #2
0
        public WordManagerTests()
        {
            TestFileHelper.Create(Filename);

            _filenameHelper = Substitute.For <IFilenameHelper>();
            _filenameHelper.GetDictionaryFilename().Returns(Filename);
            _wordService = Substitute.For <IWordService>();
        }
        public void TestUserWordGame()
        {
            TestFileHelper.Create(Filename);
            var userGame = new UserWordGame(_wordService, _filenameHelper);

            userGame.AddWordToList("sheep");
            userGame.AddWordToList("sloth");
            userGame.AddWordToList("dinosaur");

            userGame.WordList.Should().HaveCount(3);
        }
        public UpdateExistingWordInDictionary()
        {
            _filenameHelper = Substitute.For <IFilenameHelper>();
            _filenameHelper
            .GetGuessedWordsFilename()
            .Returns(Filename);
            _filenameHelper.GetDictionaryFilename().Returns(Filename);

            TestFileHelper.Create(Filename);
            _fileHelper  = new FileHelper();
            _wordService = new WordService(_wordExistenceHelper, _wordHelper, _wordDefinitionHelper, _fileHelper, _filenameHelper);
        }
Example #5
0
        public AddNewWordToDictionaryTests()
        {
            _wordDefinitionHelper = Substitute.For <IWordDefinitionHelper>();
            _wordExistenceHelper  = Substitute.For <IWordExistenceHelper>();
            _wordHelper           = Substitute.For <IWordHelper>();
            _fileHelper           = new FileHelper();
            _filenameHelper       = Substitute.For <IFilenameHelper>();
            _filenameHelper.GetDictionaryFilename().Returns(Filename);
            _filenameHelper.GetGuessedWordsFilename().Returns(Filename);

            if (File.Exists(Filename))
            {
                File.Delete(Filename);
            }

            TestFileHelper.Create(Filename);
        }
        public AutomaticallySetTemporaryDefinitions()
        {
            TestFileHelper.Create(Filename);

            var json = TestFileHelper.Read(Filename);

            _webDictionaryRequestHelper = Substitute.For <IWebDictionaryRequestHelper>();
            _wordExistenceHelper        = Substitute.For <IWordExistenceHelper>();
            _wordDefinitionHelper       = Substitute.For <IWordDefinitionHelper>();
            _fileHelper = new FileHelper();

            _filenameHelper = Substitute.For <IFilenameHelper>();
            _filenameHelper.GetGuessedWordsFilename().Returns(Filename);
            _filenameHelper.GetDictionaryFilename().Returns(Filename);

            _wordService = new WordService(_wordExistenceHelper, _wordHelper, _wordDefinitionHelper, _fileHelper, _filenameHelper);
            _dictionary  = _wordService.GetDictionary();
        }
        public WordStatusTests()
        {
            _filenameHelper = Substitute.For <IFilenameHelper>();
            _filenameHelper
            .GetGuessedWordsFilename()
            .Returns(Filename);

            _filenameHelper
            .GetDictionaryFilename()
            .Returns(Filename);

            TestFileHelper.Create(Filename);
            var json = TestFileHelper.Read(Filename);

            _wordDefinitionHelper = Substitute.For <IWordDefinitionHelper>();
            _wordExistenceHelper  = Substitute.For <IWordExistenceHelper>();
            _wordHelper           = Substitute.For <IWordHelper>();
            _fileHelper           = new FileHelper();

            _wordService = new WordService(_wordExistenceHelper, _wordHelper, _wordDefinitionHelper, _fileHelper, _filenameHelper);
            _dictionary  = _wordService.GetDictionary();
        }
        public AutomaticallyAddNewWordToDictionaryTests()
        {
            _wordDefinitionHelper = Substitute.For <IWordDefinitionHelper>();
            _wordExistenceHelper  = Substitute.For <IWordExistenceHelper>();
            _wordHelper           = Substitute.For <IWordHelper>();
            _filenameHelper       = Substitute.For <IFilenameHelper>();
            _filenameHelper.GetDictionaryFilename().Returns(Filename);
            _filenameHelper.GetGuessedWordsFilename().Returns(Filename);
            _fileHelper = new FileHelper();


            if (File.Exists(Filename))
            {
                File.Delete(Filename);
            }

            TestFileHelper.Create(Filename);
            _wordService = new WordService(_wordExistenceHelper, _wordHelper, _wordDefinitionHelper, _fileHelper, _filenameHelper);
            var json = TestFileHelper.Read(Filename);

            _dictionary = _wordService.GetDictionary();
        }