Esempio n. 1
0
        public async void TestHasProfanityVerbosityResult()
        {
            var profanityList = new ProfanityListServiceStub(new List <string> {
                "ah", "oh", "eh"
            });
            var function = new CheckProfanityService(profanityList, null);

            var errText = "ah oh uh oh";
            var stream  = this.GetStream(errText);

            var res = await function.CheckProfanity(stream, EnumExecuteDetail.Verbosity);

            Assert.Equal(EnumResultStatus.TextHasProfanity, res.ResultStatus);
            Assert.Equal(3, res.CheckingLog.Count);
        }
Esempio n. 2
0
        public async void TestHasProfanityDetailResult()
        {
            var context       = new TestLambdaContext();
            var profanityList = new ProfanityListServiceStub(new List <string> {
                "ah", "oh", "eh"
            });
            var function = new CheckProfanityService(profanityList, null);

            var errText = "ah oh uh oh";
            var stream  = this.GetStream(errText);

            var res = await function.CheckProfanity(stream, EnumExecuteDetail.Detailed);

            Assert.Equal(EnumResultStatus.TextHasProfanity, res.ResultStatus);
            Assert.Equal(3, res.ProfanityMessagesCount);
            Assert.Equal(2, res.CheckingLog.Count);
            Assert.Equal(2, res.CheckingLog.Single(x => x.Profanity == "oh").Count);
            Assert.Equal(1, res.CheckingLog.Single(x => x.Profanity == "ah").Count);
        }