Beispiel #1
0
        public ActionResult Create(string searchTerm, string phraseToSearch)
        {
            WordToSearch        newWordToSearch = new WordToSearch(searchTerm, phraseToSearch);
            List <WordToSearch> listOfSearches  = WordToSearch.AllSearches;

            return(View("Index", listOfSearches));
        }
Beispiel #2
0
        public void CheckValueInArray_CheckArrayToContainSearchTerm_True()
        {
            WordToSearch newSearch = new WordToSearch("cat", "the bat cat the hat");

            string[] searchArray = newSearch.MakeSearchTermArray(newSearch.SearchTerm);
            string[] stringArray = newSearch.MakeSentenceArray(newSearch.PhraseToSearch);
            Assert.AreEqual(2, newSearch.DoesItContain(searchArray, stringArray));
        }
Beispiel #3
0
        public void CheckValueInDictionary_KeyValuePresent_true()
        {
            WordToSearch newSearch = new WordToSearch("cat", "cat cat it is a cat");
            int          key       = newSearch.CountTheNumberOfTimesTermAppears();
            string       value     = newSearch.PhraseToSearch;

            newSearch.SetDictionary();
            Assert.AreEqual("cat cat it is a cat", newSearch.GetDictionary(key));
        }
Beispiel #4
0
        public ActionResult Show(int id, string phraseToSearch)
        {
            WordToSearch             phrase   = WordToSearch.Find(id);
            int                      theCount = phrase.CountTheNumberOfTimesTermAppears();
            Dictionary <int, string> model    = new Dictionary <int, string>();

            model.Add(theCount, phrase.PhraseToSearch);
            // model.Add("Phrase", phrase.PhraseToSearch);
            return(View(model));
        }
        public ActionResult Show(int wordToSearchId, int countDisplayId)
        {
            CountDisplay countDisplay         = CountDisplay.Find(countDisplayId);
            Dictionary <string, object> model = new Dictionary <string, object>();
            WordToSearch wordToSearch         = WordToSearch.Find(wordToSearchId);

            model.Add("countDisplay", countDisplay);
            model.Add("wordToSearch", wordToSearch);
            return(View(model));
        }
        public ActionResult New(int wordCounterId)
        {
            WordToSearch phrase = WordToSearch.Find(wordCounterId);

            return(View(phrase));
        }
Beispiel #7
0
        public void CheckValueInArray_CountHowManySearchTermsAppear_3()
        {
            WordToSearch newSearch = new WordToSearch("cat", "cat cat it is a cat");

            Assert.AreEqual(3, newSearch.CountTheNumberOfTimesTermAppears());
        }
Beispiel #8
0
        public void CheckValueInArray_InputArrayLength_5()
        {
            WordToSearch newSearch = new WordToSearch("cat", "the cat in the hat");

            Assert.AreEqual(5, newSearch.MakeSentenceArray(newSearch.PhraseToSearch).Length);
        }
Beispiel #9
0
        public void CheckValueInArray_WordAddedToArray_True()
        {
            WordToSearch newSearch = new WordToSearch("cat", "the cat in the hat");

            Assert.AreEqual(typeof(WordToSearch), newSearch.GetType());
        }