public void setupTests()
        {
            stringStripper = new StringStripper();
            countCensorWords = new CountCensoredWords(stringStripper);

            censorList = new ArrayList();

            censorList.Add("dog"); censorList.Add("cat"); censorList.Add("large");

            countCensorWords.setNewCensorList(censorList);  // pass the test censorList to the object
        }
Exemplo n.º 2
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
        }