public void countCharsTest2()
        {
            var countCharsObj = new CountChars(stringStripper);
            String input = "I have lots of aaaaaaaaaas";
            String letter = "a";
            int expected = 11;
            int actual = countCharsObj.countChars(letter, input);

            Assert.AreEqual(expected, actual);
        }
        public void countCharsTest3()
        {
            var countCharsObj = new CountChars(stringStripper);
            String input = "I'm an awkward case.";
            String letter = "2";
            int expected = 0;
            int actual = countCharsObj.countChars(letter, input);

            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            stringStriper = new StringStripper();
            countChars = new CountChars(stringStriper);
            palindromeTest = new PalindromeCheck(stringStriper);
            countCensoredWords = new CountCensoredWords(stringStriper);
            censorWords = new CensorWords(stringStriper);
            censorPalindromes = new CensorPalindromes(stringStriper, palindromeTest);

            Console.WriteLine("Task 1");
            countChars.printCountChars("e", "I have some cheese");
            countChars.printCountChars("a", "I have lots of aaaaaaaaaas");
            countChars.printCountChars("2", "I'm an awkward case");

            Console.WriteLine();
            Console.WriteLine("Task 2");
            palindromeTest.printPalindromeTest("UFO tofu");
            palindromeTest.printPalindromeTest("God saved Eva's dog");
            palindromeTest.printPalindromeTest("I am definitely not a palindrome.");

            Console.WriteLine();
            Console.WriteLine("Task 3, Part A");
            censorWordList = makeCensorList("dog", "cat", "large");      // temp, do in test class
            countCensoredWords.setNewCensorList(censorWordList);
            countCensoredWords.printCensoredWords("I have a cat named Meow and a dog name Woof. I love the dog a lot. He is larger than a small horse.");

            Console.WriteLine();
            Console.WriteLine("Task 3, Part B");
            censorWords.setNewCensorList(censorWordList);
            censorWords.printCensoredWords("I have a cat named Meow and a dog name Woof. I love the dog a lot. He is larger than a small horse.");

            Console.WriteLine();
            Console.WriteLine("Task 3, Part C");
            censorPalindromes.printCensoredWords("Anna went to vote in the election to fulfil her civic duty");

            Console.Write("Hit return to exit >>");
            Console.ReadLine(); // debugging, wait for human input to exit
        }
 public void setupTests()
 {
     stringStripper = new StringStripper();
     countCharsObj = new CountChars(stringStripper);
 }