public void WithAnyCase_SetsCorrectIgnoreCaseRegexOptionAndHasMultiLineRegexOptionAsDefault()
        {
            verbEx.WithAnyCase();

            var regex = verbEx.ToRegex();

            Assert.IsTrue(regex.Options.HasFlag(RegexOptions.IgnoreCase), "RegexOptions should have ignoreCase");
            Assert.IsTrue(regex.Options.HasFlag(RegexOptions.Multiline), "RegexOptions should have MultiLine as default");
        }
        public void RemoveModifier_RemoveModifierM_RemovesMulitilineAsDefault()
        {
            verbEx = VerbalExpressions.DefaultExpression;
            var regex = verbEx.ToRegex();

            Assert.IsTrue(regex.Options.HasFlag(RegexOptions.Multiline), "RegexOptions should have MultiLine as default");

            verbEx.RemoveModifier('m');
            regex = verbEx.ToRegex();

            Assert.IsFalse(regex.Options.HasFlag(RegexOptions.Multiline), "RegexOptions should now have been removed");
        }
        public void UseOneLineSearchOption_WhenCalled_ShouldChangeMultilineModifier()
        {
            //Arrange
            verbEx.UseOneLineSearchOption(false);
            var regex = verbEx.ToRegex();

            Assert.IsTrue(regex.Options.HasFlag(RegexOptions.Multiline), "RegexOptions should now be present");
            //Act
            verbEx.UseOneLineSearchOption(true);
            //Assert
            regex = verbEx.ToRegex();
            Assert.IsFalse(regex.Options.HasFlag(RegexOptions.Multiline), "RegexOptions should now have been removed");
        }
        public void Word_WhenCalled_ReturnsExpectedNumberOfWords()
        {
            //Arrange
            verbEx = VerbalExpressions.DefaultExpression;
            string text          = "three words here";
            int    expectedCount = 3;

            //Act
            verbEx.Word();
            Regex currentExpression = verbEx.ToRegex();
            int   result            = currentExpression.Matches(text).Count;

            //Assert
            Assert.AreEqual(expectedCount, result);
        }
        RegexTest()
        {
            // PM> Install-Package VerbalExpressions-official

            // http[s]://www.domain.com

            VerbalExpressions expression = new VerbalExpressions()
                                           .StartOfLine()
                                           .Then("http")
                                           .Maybe("s")
                                           .AnythingBut(" ")
                                           .EndOfLine();

            Regex regex = expression.ToRegex();

            string url = "http://www.vavatech.pl:8080";

            bool isValid = expression.Test(url);
        }