Beispiel #1
0
        public void CheckBadWordList()
        {
            var sut      = new BadWordService(_badWords);
            var badWords = sut.GetBadWordList();

            Assert.That(badWords == "swine,bad,nasty,horrible");
        }
Beispiel #2
0
        public void TestStory2Output()
        {
            var injectService = new BadWordService(_badWords);
            var sut           = new AppService(injectService);
            var output        = sut.UpdateBadWordList("swine,bad,nasty,horrible,smelly,stinky,ugly");

            Assert.That(output == "New bad word list set, there are now 7 bad words.");
        }
Beispiel #3
0
        public void TestStory3Output()
        {
            var injectService = new BadWordService(_badWords);
            var sut           = new AppService(injectService);
            var output        = sut.NegativeWordFilter(
                "The weather in Manchester in winter is bad. It rains all the time - it must be horrible for people visiting.");

            Assert.That(output == "Filtered text: The weather in Manchester in winter is b#d. It rains all the time - it must be h######e for people visiting.");
        }
Beispiel #4
0
        public void TestStory1Output()
        {
            var injectService = new BadWordService(_badWords);
            var sut           = new AppService(injectService);
            var output        = sut.NegativeWordCounter(
                "The weather in Manchester in winter is bad. It rains all the time - it must be horrible for people visiting.");

            Assert.That(output == "Scanned the text: The weather in Manchester in winter is bad. It rains all the time - it must be horrible for people visiting.\r\nTotal Number of negative words: 2");
        }
Beispiel #5
0
        public void CheckSetBadWordList()
        {
            var sut = new BadWordService(_badWords);

            sut.SetBadWordList("swine,bad,nasty,horrible,smelly,stinky,ugly");
            var badWords = sut.GetBadWordList();

            Assert.That(badWords == "swine,bad,nasty,horrible,smelly,stinky,ugly");
        }
Beispiel #6
0
        public void CheckBadWordFilter()
        {
            var sut     = new BadWordService(_badWords);
            var content =
                "The weather in Manchester in winter is bad. It rains all the time - it must be horrible for people visiting.";

            var filteredText = sut.FilterContentForBadWords(content);

            Assert.That(filteredText == "The weather in Manchester in winter is b#d. It rains all the time - it must be h######e for people visiting.");
        }
Beispiel #7
0
        public void CheckBadWordCounter()
        {
            var sut     = new BadWordService(_badWords);
            var content =
                "The weather in Manchester in winter is bad. It rains all the time - it must be horrible for people visiting.";

            var badWordCount = sut.GetBadWordCount(content);

            Assert.That(badWordCount == 2);
        }
Beispiel #8
0
 public void Init()
 {
     badWordService = new BadWordService();
 }