public void GetSentence_ReturnSentence_String() { string sentenceInput = "I like coffee."; WordSentence newWordSentence = new WordSentence("test", "I like coffee."); string result = newWordSentence.GetSentence(); Assert.AreEqual(sentenceInput, result); }
public void GetWord_ReturnWord_String() { string wordInput = "coffee"; WordSentence newWordSentence = new WordSentence("coffee", "test"); string result = newWordSentence.GetWord(); Assert.AreEqual(wordInput, result); }
public ActionResult Show(string word, string sentence) { Dictionary <string, object> model = new Dictionary <string, object>(); RepeatCounter newRepeatCounter = new RepeatCounter(word, sentence); WordSentence newWordSentence = new WordSentence(word, sentence); newWordSentence.AddResult(newRepeatCounter.WordInSentence()); model.Add("repeatCounter", newRepeatCounter); model.Add("wordSentence", newWordSentence); return(View(model)); }
public void SetSentence_InputStringSentence_String() { string oldSentenceInput = "I like coffee."; WordSentence newWordSentence = new WordSentence("test", oldSentenceInput); string newSentence = "My car is a fast car."; newWordSentence.SetSentence(newSentence); string result = newWordSentence.GetSentence(); Assert.AreEqual(newSentence, result); }
public void SetWord_InputStringWord_String() { string oldWordInput = "coffee"; WordSentence newWordSentence = new WordSentence(oldWordInput, "test"); string newWord = "car"; newWordSentence.SetWord(newWord); string result = newWordSentence.GetWord(); Assert.AreEqual(newWord, result); }
public void WordInSentence_WordNotInSentence_0() { //Arrange WordSentence newWordSentence = new WordSentence("tea", "I like coffee"); string wordInput = newWordSentence.GetWord(); string sentenceInput = newWordSentence.GetSentence(); RepeatCounter newRepeatCounter = new RepeatCounter(wordInput, sentenceInput); //Act int result = newRepeatCounter.WordInSentence(); //Assert Assert.AreEqual(0, result); }
public void WordInSentence_DoNotCountWordsContainedInWords_Int() { //Arrange WordSentence newWordSentence = new WordSentence("read", "Are you ready??"); string wordInput = newWordSentence.GetWord(); string sentenceInput = newWordSentence.GetSentence(); RepeatCounter newRepeatCounter = new RepeatCounter(wordInput, sentenceInput); //Act int result = newRepeatCounter.WordInSentence(); //Assert Assert.AreEqual(0, result); }
public void WordInSentence_CountsWordsByPunctuation_Int() { //Arrange WordSentence newWordSentence = new WordSentence("hungry", "Are you Hungry??"); string wordInput = newWordSentence.GetWord(); string sentenceInput = newWordSentence.GetSentence(); RepeatCounter newRepeatCounter = new RepeatCounter(wordInput, sentenceInput); //Act int result = newRepeatCounter.WordInSentence(); //Assert Assert.AreEqual(1, result); }
public void WordInSentence_CountWordsInSentence_Int() { //Arrange WordSentence newWordSentence = new WordSentence("car", "My car is faster than your car"); string wordInput = newWordSentence.GetWord(); string sentenceInput = newWordSentence.GetSentence(); RepeatCounter newRepeatCounter = new RepeatCounter(wordInput, sentenceInput); //Act int result = newRepeatCounter.WordInSentence(); //Assert Assert.AreEqual(2, result); }
[TestMethod] //Tests Dictionary type in Post method public void Show_CreatesTypeDictionary_Dictionary() { //Arrange WordCounterController newResult = new WordCounterController(); Dictionary <string, object> newModel = new Dictionary <string, object>(); string newWord = "test"; string newSentence = "this is a test"; RepeatCounter newRepeatCounter = new RepeatCounter(newWord, newSentence); WordSentence newWordSentence = new WordSentence(newWord, newSentence); //Act newModel.Add("wordSentence", newWordSentence); newModel.Add("repeatCounter", newRepeatCounter); //Assert Assert.IsInstanceOfType(newModel, typeof(Dictionary <string, object>)); }
static void Main() { Console.WriteLine("Please enter a word: "); string word = Console.ReadLine(); Console.WriteLine("Please enter a sentence using the word you selected (or not!): "); string sentence = Console.ReadLine(); WordSentence myWordSentence = new WordSentence(); int wordCount = myWordSentence.WordCounter(word, sentence); if (wordCount == 0) { Console.WriteLine("Your sentence does not contain your word ☹️"); } else { Console.WriteLine("Your sentence contains your word " + wordCount + " times!"); } }
public async Task CreateSentences(int wordId, IList <string> sentences) { foreach (string sentenceContent in sentences) { Sentence sentence = new Sentence() { Content = sentenceContent, CreatedOn = DateTime.Now, IsDeleted = false, }; WordSentence wordSentence = new WordSentence() { WordId = wordId, Sentence = sentence, CreatedOn = DateTime.Now, IsDeleted = false, }; await this.wordsSentences.Add(wordSentence); } }
public ActionResult Destroy() { WordSentence.ClearAll(); return(View()); }
public ActionResult Index() { List <WordSentence> wordSentenceList = WordSentence.GetAll(); return(View(wordSentenceList)); }
public void WordSentenceConstructor_CreatesInstanceOfItem_Item() { WordSentence newWordSentence = new WordSentence("test", "test"); Assert.AreEqual(typeof(WordSentence), newWordSentence.GetType()); }