public void Add_AddDotCom_DoesNotMatchGoogleComWithoutDot() { verbEx = VerbalExpressions.DefaultExpression; verbEx.Add(".com"); var isMatch = verbEx.IsMatch("http://www.googlecom/"); Assert.IsFalse(isMatch, "Should not match 'ecom'"); }
public void Add_WhenNullStringPassedAsParameter_ShouldThrowNullArgumentException() { //Arrange verbEx = VerbalExpressions.DefaultExpression; string value = null; //Act //Assert verbEx.Add(value); }
public void WithAnyCase_AddwwwWithAnyCase_DoesMatchwWw() { verbEx = VerbalExpressions.DefaultExpression; verbEx.Add("www") .WithAnyCase(); var isMatch = verbEx.IsMatch("wWw"); Assert.IsTrue(isMatch, "Should match any case"); }
public void Or_VerbalExpressionsUrlOrVerbalExpressionEmail_DoesMatchEmailAndUrl() { verbEx = VerbalExpressions.DefaultExpression; verbEx.Add(CommonRegex.Url) .Or(CommonRegex.Email); Assert.IsTrue(verbEx.IsMatch("*****@*****.**"), "Should match email address"); Assert.IsTrue(verbEx.IsMatch("http://www.google.com"), "Should match url address"); }
public void StartOfLine_WhenPlacedInRandomCallOrder_ShouldAppendAtTheBeginningOfTheExpression() { verbEx = VerbalExpressions.DefaultExpression; verbEx.Add("test") .Add("ing") .StartOfLine(); string text = "testing1234"; Assert.IsTrue(verbEx.IsMatch(text), "Should match that the text starts with test"); }
public void Or_AddComOrOrg_RegexIsAsExpecteds() { verbEx = VerbalExpressions.DefaultExpression; verbEx.Add("com").Or("org"); Assert.AreEqual("(com)|(org)", verbEx.ToString()); }
public void Or_AddComOrOrg_DoesMatchComAndOrg() { verbEx = VerbalExpressions.DefaultExpression; verbEx.Add("com").Or("org"); Console.WriteLine(verbEx); Assert.IsTrue(verbEx.IsMatch("org"), "Should match 'org'"); Assert.IsTrue(verbEx.IsMatch("com"), "Should match 'com'"); }
public void Multiple_WhenParamIsGiven_ShouldMatchOneOrMultipleValuesGiven() { //Arrange verbEx = VerbalExpressions.DefaultExpression; string text = "testesting 123 yahoahoahou another test"; string expectedExpression = "y(aho)+u"; //Act verbEx.Add("y") .Multiple("aho") .Add("u"); //Assert Assert.IsTrue(verbEx.Test(text)); Assert.AreEqual(expectedExpression, verbEx.ToString()); }
public void EndOfLine_AddDotComtEndOfLine_DoesMatchDotComInEnd() { verbEx = VerbalExpressions.DefaultExpression; verbEx.Add(".com") .EndOfLine(); var isMatch = verbEx.IsMatch("www.google.com"); Assert.IsTrue(isMatch, "Should match '.com' in end"); }
public void EndOfLine_AddDotComEndOfLine_DoesNotMatchSlashInEnd() { verbEx = VerbalExpressions.DefaultExpression; verbEx.Add(".com") .EndOfLine(); var isMatch = verbEx.IsMatch("http://www.google.com/"); Assert.IsFalse(isMatch, "Should not match '/' in end"); }