public static void Main(string[] args)
        {
            var contentAnalyzer = new ContentAnalyzer(new FakeRepository());             // Could also have used Moq.

            Console.WriteLine("Story 1");
            Console.WriteLine("Scanned the text:");
            contentAnalyzer.SetContentFilteringStatus(false);
            Console.WriteLine(contentAnalyzer.GetContent());
            Console.WriteLine("Total Number of negative words: " + contentAnalyzer.GetBannedWordCount());
            Console.WriteLine();

            Console.WriteLine("Story 2");
            Console.WriteLine("I haven't implemented an UpdateBannedWords method but the unit tests prove that the list of banned words is not hard coded.");
            Console.WriteLine();

            Console.WriteLine("Story 3");
            contentAnalyzer.SetContentFilteringStatus(true);
            Console.WriteLine(contentAnalyzer.GetContent());
            Console.WriteLine();

            Console.WriteLine("Story 4");
            Console.WriteLine("Scanned the text:");
            contentAnalyzer.SetContentFilteringStatus(false);
            Console.WriteLine(contentAnalyzer.GetContent());
            Console.WriteLine("Total Number of negative words: " + contentAnalyzer.GetBannedWordCount());
            Console.WriteLine();

            Console.WriteLine("Press ANY key to exit.");
            Console.ReadKey();
        }
        public void BannedWordListNotHardCodedTest()
        {
            const string content = "weather in manchester is bad and horrible.";

            // The same content returns 2 banned words in the first case and
            // 1 in the second case when we change the master list of banned words.
            var mockRepository1 = new Mock <IContentRepository>();

            mockRepository1.Setup(x => x.GetBannedWords()).Returns(new List <string> {
                "bad", "horrible"
            });
            mockRepository1.Setup(x => x.GetContent()).Returns(content);
            var contentAnalyser1 = new ContentAnalyzer(mockRepository1.Object);
            int actualCount1     = contentAnalyser1.GetBannedWordCount();

            Assert.AreEqual(2, actualCount1);

            var mockRepository2 = new Mock <IContentRepository>();

            mockRepository2.Setup(x => x.GetBannedWords()).Returns(new List <string> {
                "horrible"
            });
            mockRepository2.Setup(x => x.GetContent()).Returns(content);
            var contentAnalyser2 = new ContentAnalyzer(mockRepository2.Object);
            int actualCount2     = contentAnalyser2.GetBannedWordCount();

            Assert.AreEqual(1, actualCount2);
        }
        public void BannedWordCountTest(string content, int expectedCount)
        {
            var mockRepository = new Mock <IContentRepository>();

            mockRepository.Setup(x => x.GetBannedWords()).Returns(new List <string> {
                "swine", "nasty", "bad", "horrible"
            });
            mockRepository.Setup(x => x.GetContent()).Returns(content);
            var contentAnalyser = new ContentAnalyzer(mockRepository.Object);
            int actualCount     = contentAnalyser.GetBannedWordCount();

            Assert.AreEqual(expectedCount, actualCount);
        }