Пример #1
0
        public void NumberOfNegativeWordsIsOutput()
        {
            var mockLogger = new Mock <ILogger>();
            var reporter   = new BadWordReporter(mockLogger.Object);

            reporter.Report("The weather in Manchester in winter is bad. It rains all the time - it must be horrible for people visiting.", new[] { "swine", "bad", "nasty", "horrible" });

            mockLogger.Verify(t => t.Output(It.Is <string>(msg => msg == "Total Number of negative words: 2")));
        }
Пример #2
0
        public void PhraseIsOutputWithBadWordsFilteredOut(string[] wordList, string phrase, string hashedPhrase)
        {
            var mockLogger = new Mock <ILogger>();
            var reporter   = new BadWordReporter(mockLogger.Object);

            reporter.Report(phrase, wordList);

            mockLogger.Verify(t => t.Output(It.Is <string>(msg => msg == hashedPhrase)));
        }
Пример #3
0
        public void PhraseIsOutput()
        {
            var mockLogger = new Mock <ILogger>();
            var reporter   = new BadWordReporter(mockLogger.Object);

            reporter.Report("a phrase", new[] { "swine", "bad", "nasty", "horrible" });

            mockLogger.Verify(t => t.Output(It.Is <string>(msg => msg == "a phrase")));
        }
Пример #4
0
        public void CanDisableBadWordFiltering()
        {
            var mockLogger = new Mock <ILogger>();
            var reporter   = new BadWordReporter(mockLogger.Object);

            reporter.DisableFiltering();

            reporter.Report("a bad word", new [] { "bad" });

            mockLogger.Verify(t => t.Output(It.Is <string>(msg => msg == "a bad word")));
        }