public void NamedReferenceWithUseKFalseToStringShouldReturnBackslashNameBetweenBrackets() { // Arrange var target = new NamedReferenceNode("name", false, false); // Act string result = target.ToString(); // Assert result.ShouldBe(@"\<name>"); }
public void NamedReferenceWithUseQuotesTrueToStringShouldReturnBackslashLowercaseKNameBetweenSingleQuotes() { // Arrange var target = new NamedReferenceNode("name", true); // Act string result = target.ToString(); // Assert result.ShouldBe(@"\k'name'"); }
public void ToStringOnNamedReferenceNodeWithPrefixShouldReturnPrefixBeforeNamedReference() { // Arrange var comment = new CommentGroupNode("This is a comment."); var target = new NamedReferenceNode("name", false) { Prefix = comment }; // Act var result = target.ToString(); // Assert result.ShouldBe(@"(?#This is a comment.)\k<name>"); }
public void CopyingNamedReferenceNodeShouldCopyOriginalNameUseQuotesAndUseK() { // Arrange var target = new NamedReferenceNode("name", true, true); // Act // RemoveNode returns a copy of the current node. var result = target.RemoveNode(new CharacterNode('x')); // Assert NamedReferenceNode namedReferenceNode = result.ShouldBeOfType <NamedReferenceNode>(); namedReferenceNode.Name.ShouldBe(target.Name); namedReferenceNode.UseQuotes.ShouldBe(target.UseQuotes); namedReferenceNode.UseK.ShouldBe(target.UseK); }