Exemplo n.º 1
0
        public void ToStringOnNamedGroupNodeWithUseQuotesTrueShouldReturnNamedGroupWithNameBetweenSingleQuotes()
        {
            // Arrange
            var target = new NamedGroupNode("name", true);

            // Act
            var result = target.ToString();

            // Assert
            result.ShouldBe("(?'name')");
        }
Exemplo n.º 2
0
        public void ToStringOnNamedGroupNodeWithUseQuotesFalseShouldReturnNamedGroupWithNameBetweenBrackets()
        {
            // Arrange
            var target = new NamedGroupNode("name", false);

            // Act
            var result = target.ToString();

            // Assert
            result.ShouldBe("(?<name>)");
        }
Exemplo n.º 3
0
        public void ToStringOnNamedGroupNodeWithChildNodeShouldReturnNamedGroupWithChildNode()
        {
            // Arrange
            var childNode = new CharacterNode('a');
            var target    = new NamedGroupNode("name", false, childNode);

            // Act
            var result = target.ToString();

            // Assert
            result.ShouldBe("(?<name>a)");
        }
Exemplo n.º 4
0
        public void ToStringOnNamedGroupNodeWithMultipleChildNodesShouldReturnNamedGroupWithChildNodes()
        {
            // Arrange
            var childNodes = new List <RegexNode> {
                new CharacterNode('a'), new CharacterNode('b'), new CharacterNode('c')
            };
            var target = new NamedGroupNode("name", false, childNodes);

            // Act
            var result = target.ToString();

            // Assert
            result.ShouldBe("(?<name>abc)");
        }
Exemplo n.º 5
0
        public void ToStringOnNamedGroupNodeWithprefixShouldReturnPrefixBeforeNamedGroupNode()
        {
            // Arrange
            var comment = new CommentGroupNode("This is a comment.");
            var target  = new NamedGroupNode("name", false)
            {
                Prefix = comment
            };

            // Act
            var result = target.ToString();

            // Assert
            result.ShouldBe("(?#This is a comment.)(?<name>)");
        }