コード例 #1
0
        public void CountNegativeWordsTest()
        {
            string content = "The horrible tea tasted horrible.";
            string[] negativeWords = new string[] { "horrible", "bad" };
            IContentAnalyser contentAnalyser = new ContentAnalyser(content, negativeWords);

            Assert.AreEqual(1, contentAnalyser.CountNegativeWords());
            Assert.AreEqual(2, contentAnalyser.CountAllNegativeWords());
        }
コード例 #2
0
        public void WriteOrginalContent()
        {
            IRepository repository = new FileRepository();
            IContentAnalyser contentAnalyser = new ContentAnalyser(repository.GetContent(), repository.GetNegativeWords());

            var negativeWords = contentAnalyser.CountNegativeWords();
            var allNegativeWords = contentAnalyser.CountAllNegativeWords();
            var content = repository.GetContent();

            Console.WriteLine("Scanned the text:");
            Console.WriteLine(content);
            Console.WriteLine("Total Number of distinct negative words: " + negativeWords);
            Console.WriteLine("Total Number of all negative words: " + allNegativeWords);

            Console.WriteLine("Press ANY key to exit.");
            Console.ReadKey();
        }