Ejemplo n.º 1
0
        public static void Start()
        {
            Console.WriteLine("Please enter a sentence:");
            string usersentence = Console.ReadLine();

            Console.WriteLine("Please enter a word to check:");
            string    userword     = Console.ReadLine();
            CountWord newCountWord = new CountWord(userword, usersentence);

            int result = newCountWord.CountRepeat();

            Console.WriteLine("The word " + userword + " appears " + result + " time(s) in the sentence.");
        }
Ejemplo n.º 2
0
        public void CountRepeat_CountsOnlyFullWord_2()
        {
            CountWord newCountWord = new CountWord("cat", "cat cathedral cat");

            Assert.AreEqual(2, newCountWord.CountRepeat());
        }
Ejemplo n.º 3
0
 public void CountWords_Test()
 {
     Assert.Equal(2, CountWord.CountWords("Hello World"));
 }
Ejemplo n.º 4
0
        public void CountRepeat_CountsWordsInSentence_1()
        {
            CountWord newCountWord = new CountWord("eggs", "eggs are one of my favorite breakfast food yay eggs");

            Assert.AreEqual(2, newCountWord.CountRepeat());
        }
Ejemplo n.º 5
0
        public void CountWord_TakesInSentence_HelloThere()
        {
            CountWord newCountWord = new CountWord("", "hello there");

            Assert.AreEqual("hello there", newCountWord.UserSentence);
        }
Ejemplo n.º 6
0
        public void CountWord_TakesInMultiCharacterWord_To()
        {
            CountWord newCountWord = new CountWord("to", "");

            Assert.AreEqual("to", newCountWord.UserWord);
        }
Ejemplo n.º 7
0
        public void CountWord_TakesInOneCharacterWord_A()
        {
            CountWord newCountWord = new CountWord("a", "");

            Assert.AreEqual("a", newCountWord.UserWord);
        }
Ejemplo n.º 8
0
        public void CountWord_Instantiates_NewInstance()
        {
            CountWord newCountWord = new CountWord("test", "this is only a test");

            Assert.AreEqual(typeof(CountWord), newCountWord.GetType());
        }