public void AddModifier_AddModifierM_Multiline() { //Arrange string text = string.Format("testin with {0} line break", Environment.NewLine); //Act verbEx.AddModifier('m'); //Assert Assert.IsTrue(verbEx.Test(text)); }
public void AddModifier_AddModifierM_Multiline() { //Arrange VerbalExpressions verbEx = VerbalExpressions.DefaultExpression; string text = string.Format("testin with {0} line break", Environment.NewLine); //Act verbEx.AddModifier('m'); //Assert Assert.True(verbEx.Test(text)); }
public void AddModifier_AddModifierS_SingleLine() { //Arrange VerbalExpressions verbEx = VerbalExpressions.DefaultExpression; string testString = "First string" + Environment.NewLine + "Second string"; //Act verbEx.Add("First string").Anything().Then("Second string"); //Assert Assert.IsFalse( verbEx.IsMatch(testString), "The dot matches a single character, except line break characters."); verbEx.AddModifier('s'); Assert.IsTrue( verbEx.IsMatch(testString), "The dot matches a single character and line break characters."); }
public VerbalExpression AddModifier(string modifier) { switch (modifier) { case "i": _modifiers |= RegexOptions.IgnoreCase; break; case "m": _modifiers |= RegexOptions.Multiline; break; case "s": _modifiers |= RegexOptions.Singleline; break; case "x": _modifiers |= RegexOptions.IgnorePatternWhitespace; break; } _verbalExpression.AddModifier(modifier.ToCharArray(0, 1)[0]); return(this); }