Ejemplo n.º 1
0
        public void FindWords(string text, string prefix, string trueListWords)
        {
            IGenericRepository <DictionaryWord> repo = new FakeRepository();
            ManagerDictionary manager = new ManagerDictionary(repo);


            manager.CreateDictionary(text);

            List <DictionaryWord> words = manager.FindWords(prefix).ToList();


            StringBuilder result = new StringBuilder();

            foreach (var word in words)
            {
                result.Append(word.Word).Append(" ");
            }

            NUnit.Framework.Assert.AreEqual(result.ToString(), trueListWords);
        }
Ejemplo n.º 2
0
        [TestCase("жил жил  ", "жил жил ", "")]                       //0 + 0
        public void UpdateDictionary(string text1, string text2, string trueResult)
        {
            IGenericRepository <DictionaryWord> repo = new FakeRepository();
            ManagerDictionary manager = new ManagerDictionary(repo);


            manager.CreateDictionary(text1);

            manager.UpdateDictionary(text2);


            StringBuilder result = new StringBuilder();

            foreach (var word in repo.Get())
            {
                result.Append(word.Word).Append(" ").Append(word.Frequency).Append(" ");
            }

            NUnit.Framework.Assert.AreEqual(result.ToString(), trueResult);
        }