public void VerbotenChecker_WhenCheckingEmptyText_ShouldReturnTrue(string text) { IVerbotenPhraseProvider provider = Substitute.For<IVerbotenPhraseProvider>(); VerbotenChecker checker = new VerbotenChecker(provider); var result = checker.ValidateText(text); result.IsSafeText.ShouldBe(true); }
public void VerbotenChecker_WhenCheckingTextWithoutVerbotenPhrases_ShouldReturnTrue() { var text = "This is a tweet containing good safe text"; IVerbotenPhraseProvider provider = Substitute.For<IVerbotenPhraseProvider>(); provider.GetVerbotenPhrases().ReturnsForAnyArgs(new List<string> { "Verboten2", "Verboten1" }); VerbotenChecker checker = new VerbotenChecker(provider); var result = checker.ValidateText(text); result.IsSafeText.ShouldBe(true); }
public void VerbotenChecker_WhenCheckingTextWithVerbotenPhraseWithDifferentCase_ShouldReturnFalsePlusViolations() { var text = "This is a tweet containing verboten"; IVerbotenPhraseProvider provider = Substitute.For<IVerbotenPhraseProvider>(); provider.GetVerbotenPhrases().ReturnsForAnyArgs(new List<string> { "Verboten" }); VerbotenChecker checker = new VerbotenChecker(provider); var result = checker.ValidateText(text); result.IsSafeText.ShouldBe(false); result.Violations.Count.ShouldBe(1); result.Violations[0].ShouldBe("Verboten"); }
public void VerbotenChecker_WhenCheckingTextWithMultipleVerbotenPhrases_ShouldReturnFalsePlusViolations() { var text = "This is a tweet containing verboten1 and verboten2"; IVerbotenPhraseProvider provider = Substitute.For<IVerbotenPhraseProvider>(); provider.GetVerbotenPhrases().ReturnsForAnyArgs(new List<string> { "Verboten2", "Verboten1" }); VerbotenChecker checker = new VerbotenChecker(provider); var result = checker.ValidateText(text); result.IsSafeText.ShouldBe(false); result.Violations.Count.ShouldBe(2); result.Violations.Contains("Verboten1").ShouldBeTrue(); result.Violations.Contains("Verboten2").ShouldBeTrue(); }
public void VerbotenChecker_WhenCheckingTextWithVerbotenPhrasesOfNullOrWhiteSpace_ShouldReturnTrue() { var text = "This is a tweet containing verboten1 and verboten2"; IVerbotenPhraseProvider provider = Substitute.For<IVerbotenPhraseProvider>(); provider.GetVerbotenPhrases().ReturnsForAnyArgs(new List<string> { null, "", " " }); VerbotenChecker checker = new VerbotenChecker(provider); var result = checker.ValidateText(text); result.IsSafeText.ShouldBe(true); }