public void ToStringOnNamedGroupNodeWithUseQuotesTrueShouldReturnNamedGroupWithNameBetweenSingleQuotes() { // Arrange var target = new NamedGroupNode("name", true); // Act var result = target.ToString(); // Assert result.ShouldBe("(?'name')"); }
public void ToStringOnNamedGroupNodeWithUseQuotesFalseShouldReturnNamedGroupWithNameBetweenBrackets() { // Arrange var target = new NamedGroupNode("name", false); // Act var result = target.ToString(); // Assert result.ShouldBe("(?<name>)"); }
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)"); }
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)"); }
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>)"); }