public void ShouldRemoveWordBoundaryNode() { // Arrange var wordBoundaryNode = new WordBoundaryNode(); var childNodes = new List <RegexNode> { wordBoundaryNode, new CharacterNode('a'), new CharacterNode('b'), new CharacterNode('c') }; var rootNode = new ConcatenationNode(childNodes); var target = new AnchorRemovalMutator(); // Act var result = target.ApplyMutations(wordBoundaryNode, rootNode); // Assert var mutation = result.ShouldHaveSingleItem(); mutation.OriginalNode.ShouldBe(wordBoundaryNode); mutation.ReplacementNode.ShouldBeNull(); mutation.ReplacementPattern.ShouldBe("abc"); mutation.DisplayName.ShouldBe("Regex anchor removal mutation"); mutation.Description.ShouldBe("Anchor \"\\b\" was removed at offset 0."); }
public void ToStringShouldReturnBackslashLowercaseB() { // Arrange var target = new WordBoundaryNode(); // Act var result = target.ToString(); // Assert result.ShouldBe(@"\b"); }
public void ToStringOnWordBoundaryNodeWithPrefixShouldReturnCommentBeforeBackslashLowercaseB() { // Arrange var comment = new CommentGroupNode("This is a comment."); var target = new WordBoundaryNode() { Prefix = comment }; // Act var result = target.ToString(); // Assert result.ShouldBe(@"(?#This is a comment.)\b"); }