Beispiel #1
0
        public void EnWordRuWord_AddWordAtWordsRepository()
        {
            Word            word1           = new Word(Guid.NewGuid(), "tea", "чай", 0);
            List <Word>     inMemoryWords   = new List <Word>();
            User            user            = new User("Artem", Guid.NewGuid(), inMemoryWords);
            UserRepository  userRepository  = new UserRepository(@"/Users/odmen/Projects/EnglishTrainer/EnglishTrainer/bin/user.json");
            WordsRepository wordsRepository = new WordsRepository(@"/Users/odmen/Projects/EnglishTrainer/EnglishTrainer/bin/testWords.json");
            UserService     userService     = new UserService(wordsRepository, userRepository);
            Session         session         = new Session(user, wordsRepository, userService);
            UserFacade      userFacade      = new UserFacade(userService, session);
            string          enWord          = "table";
            string          ruWord          = "стол";

            userFacade.AddWordWordsRepository(enWord, ruWord);

            List <string> expected = new List <string>()
            {
                "table"
            };
            List <string> arr = new List <string>();

            var dict = wordsRepository.GetWords();

            arr = dict.Where(item => item._enWord == "table")
                  .Select(item => item._enWord).ToList();

            Equals(arr, expected);
        }
 public void Shoud_Correctly_Parse_All_Unique_Words_From_Input_File(object[] inputWords)
 {
     wordsRepository = new WordsRepository(config);
     Assert.IsTrue(inputWords.All(inputWord => wordsRepository.GetWords().Any(word => word.word == (string)inputWord)));
 }
 public void Should_Return_Not_Empy_Hashset()
 {
     wordsRepository = new WordsRepository(config);
     Assert.IsTrue(wordsRepository.GetWords().GetType() == typeof(HashSet <WordModel>) && wordsRepository.GetWords().Count > 0);
 }
Beispiel #4
0
 public async Task OnGet()
 {
     Words = await _wordsRepository.GetWords();
 }