public void Censor_InputIsEmptyAndAlternateReplacementCharProvided_ReturnsCensoredString() { var filter = new ProfanityFilter(); var result = filter.Censor("", '@'); const string expected = ""; Assert.Equal(expected, result); }
public void Censor_InputContainsPermittedTerm_ReturnsOriginalString() { var filter = new ProfanityFilter(); var result = filter.Censor("Scunthorpe"); const string expected = "Scunthorpe"; Assert.Equal(expected, result); }
public void Censor_InputContainsOnlyWhitespace_ReturnsOriginalString() { var filter = new ProfanityFilter(); var result = filter.Censor(" "); const string expected = " "; Assert.Equal(expected, result); }
public void Censor_InputIsOnlyNonAlphaNumericCharacters_ReturnsOriginalString() { var filter = new ProfanityFilter(); var result = filter.Censor("!@£$*&^&$%^$£%£$@£$£@$£$%%^"); const string expected = "!@£$*&^&$%^$£%£$@£$£@$£$%%^"; Assert.Equal(expected, result); }
public void Censor_InputIsEmpty_ReturnsEmptyCollection() { var filter = new ProfanityFilter(); var result = filter.Censor(""); const string expected = ""; Assert.Equal(expected, result); }
public void Censor_InputContainsPermittedTermInMixedCase_ReturnsOriginalString() { var filter = new ProfanityFilter(); filter.Terms.Permitted.Add("scunthrope"); var result = filter.Censor("ScUnThOrPe"); const string expected = "ScUnThOrPe"; Assert.Equal(expected, result); }
public void Censor_InputEndsWithProhibited_ReturnsCensoredString() { var filter = new ProfanityFilter(); filter.Terms.Prohibited.Add("c**t"); var result = filter.Censor("scunthorpe c**t"); const string expected = "scunthorpe ****"; Assert.Equal(expected, result); }
public void Censor_InputHasMultipleNumbersAppendedAndPrependedToProhibitedTerm_ReturnsCensoredString() { var filter = new ProfanityFilter(); filter.Terms.Prohibited.Add("m**********r"); var result = filter.Censor("You are a 123motherfucker123", '*'); const string expected = "You are a ******************"; Assert.Equal(expected, result); }
public void Censor_InputContainsProhibitedTermTwice_ReturnsCensoredString() { var filter = new ProfanityFilter(); filter.Terms.Prohibited.Add("c**t"); var result = filter.Censor("c**t c**t"); const string expected = "**** ****"; Assert.Equal(expected, result); }
public void Censor_InputHasProhibitedTermAndTrailingSpace_ReturnsCensoredString() { var filter = new ProfanityFilter(); filter.Terms.Prohibited.Add("f**k"); var result = filter.Censor("Hello you little f**k "); const string expected = "Hello you little **** "; Assert.Equal(expected, result); }
public void Censor_InputContainsProhibitedTerm_ReturnsCensoredString() { // This test is used in the main README.md so we should always // ensure it passes var filter = new ProfanityFilter(); filter.Terms.Prohibited.Add("world"); var result = filter.Censor("Hello, world!"); Assert.Equal("Hello, *****!", result); }
public void Censor_InputContainsNoProhibitedTermsAndAlternateReplacementCharProvided_ReturnsCensoredString() { var filter = new ProfanityFilter(); filter.Terms.Prohibited.Add("2 girls 1 cup"); filter.Terms.Prohibited.Add("twatting"); var result = filter.Censor("Hello, I am a fish.", '*'); const string expected = "Hello, I am a fish."; Assert.Equal(expected, result); }
public void Censor_InputContainsProhibitedTermWithTrailingComma_ReturnsCensoredString() { var filter = new ProfanityFilter(); filter.Terms.Prohibited.Add("twat"); var result = filter.Censor("You are a stupid little twat, did you know that?"); const string expected = "You are a stupid little ****, did you know that?"; Assert.Equal(expected, result); }
public void Censor_InputContainsProhibitedTermsAndAlternateReplacementCharProvided_ReturnsCensoredString() { var filter = new ProfanityFilter(); filter.Terms.Prohibited.Add("stealeth"); filter.Terms.Prohibited.Add("rend"); var result = filter.Censor("For him that stealeth, or borroweth and returneth not, this book from its owner, let it change into a serpent in his hand & rend him.", '@'); const string expected = "For him that @@@@@@@@, or borroweth and returneth not, this book from its owner, let it change into a serpent in his hand & @@@@ him."; Assert.Equal(expected, result); }
public void Censor_InputContainsProhibitedTermWithTrailingPeriod_ReturnsCensoredString() { var filter = new ProfanityFilter(); filter.Terms.Prohibited.Add("f****r"); filter.Terms.Prohibited.Add("shit"); var result = filter.Censor("Mary had a little shit lamb who was a little f****r."); const string expected = "Mary had a little **** lamb who was a little ******."; Assert.Equal(expected, result); }
public void Censor_InputContainsPermittedTermInLowerCase_ReturnsOriginalString() { var filter = new ProfanityFilter(); filter.Terms.Prohibited.Add("c**t"); filter.Terms.Permitted.Add("scunthorpe"); var result = filter.Censor("scunthorpe"); const string expected = "scunthorpe"; Assert.Equal(expected, result); }
public void Censor_InputContainsCapitalisedProhibitedTerms_ReturnsCensoredString() { var filter = new ProfanityFilter(); filter.Terms.Prohibited.Add("f**k"); filter.Terms.Prohibited.Add("f*****g"); filter.Terms.Prohibited.Add("c**k"); filter.Terms.Prohibited.Add("shit"); filter.Terms.Prohibited.Add("c**t"); var result = filter.Censor("I F*****g Live In Scunthorpe And It Is A Shit Place To Live. I Would Much Rather Live In Penistone You Great Big C**k F**k.", '*'); const string expected = "I ******* Live In Scunthorpe And It Is A **** Place To Live. I Would Much Rather Live In Penistone You Great Big **** ****."; Assert.Equal(expected, result); }
public void Censor_InputContainsMultipleProhibitedTerms_ReturnsCensoredString() { var filter = new ProfanityFilter(); filter.Terms.Prohibited.Add("f**k"); filter.Terms.Prohibited.Add("f*****g"); filter.Terms.Prohibited.Add("c**k"); filter.Terms.Prohibited.Add("shit"); filter.Terms.Prohibited.Add("c**t"); var result = filter.Censor("I f*****g live in Scunthorpe and it is a shit place to live. I would much rather live in penistone you great big c**k f**k.", '*'); const string expected = "I ******* live in Scunthorpe and it is a **** place to live. I would much rather live in penistone you great big **** ****."; Assert.Equal(expected, result); }